Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > |
Exercise 3: SwitchesIntroductionSwitches exist in various incarnations. There is the simple mechanical switches: on/off or push button switches but there are also switches than turn on or off with various external conditions:
Exercise 1:The push button switch is connected to GPIO 17 on the ESP32 board. Write a script that polls the state of the switch every 100 ms and prints state changes (only print out a message when the switch state has changed). Catch <ctrl> C to smoothly exit the program. Check https://docs.micropython.org/en/latest/esp8266/tutorial/pins.html and https://docs.micropython.org/en/latest/esp32/quickref.html for information on how to accomplish this.Exercise 2:Do the same thing as in exercise 1 but use external interrupts and a callback routine to do the job.Exercise 3:Combine this exercise with the exercise on LEDs: Switch the builtin LED on when the button is pressed and off when it is released -- Uli Raich - 2020-05-06Comments
|