Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

LED control code in "p08_DigitalHourglass" affects non-LED pins after completion of timer #83

Closed as not planned
Assignees
Labels
conclusion: off topicOff topic for this repository topic: codeRelated to content of the project itself type: imperfectionPerceived defect in any part of project
@drf5n

Description

if (currentTime - previousTime > interval) {
// save the current time as the last time you changed an LED
previousTime = currentTime;
// Turn the LED on
digitalWrite(led, HIGH);
// increment the led variable
// in 10 minutes the next LED will light up
led++;
if (led == 7) {
// the hour is up
}
}

Note that the code in the Digital Hourglass example starts cycling above pin 7 after the hour is up, setting pins to low and essentially setting the pinMode(switchPin,INPUT_PULLUP), overriding the external pulldown, and making the button non-functional.

The code should either reset the hourglass automatically, or check that it is in the 2-7 range before setting the pin to low.

Maybe change the test to:

if (currentTime - previousTime > interval && led <= 7 ) {

Sped-up (6 seconds/step) Example:

https://wokwi.com/projects/422992836439284737

Metadata

Metadata

Assignees

Labels

conclusion: off topicOff topic for this repository topic: codeRelated to content of the project itself type: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /