Homework lesson 24

Sdílet
Vložit
  • čas přidán 27. 08. 2024
  • Homework lesson 24 for Paul McWorthers arduino r4 wifi tutorial series
    • Arduino Uno R4 WiFi LE...

Komentáře • 4

  • @paulmcwhorter
    @paulmcwhorter Před měsícem +1

    Now test your solution by varying how quickly you push the button. Try long and short button pushes.

    • @shineeyman
      @shineeyman  Před měsícem

      Ok will do!! Should the program always work regardless of the amount of time the button is pressed?

    • @paulmcwhorter
      @paulmcwhorter Před měsícem

      @@shineeyman Yes. Your user might have quick or slow fingers. The problem just got harder for you.

    • @shineeyman
      @shineeyman  Před měsícem

      @@paulmcwhorter Tickled my brain!
      I finally solved this problem with a while loop in the if statement.
      if (buttonVal == 0 & ledVal == 0){
      while (buttonVal == 0) {
      buttonVal = digitalRead(buttonPin);
      }
      digitalWrite(ledPin, HIGH);
      }
      and a similar block of code to turn the light off. Interested to see how you solve this problem!