turn_on_led_using_webpage
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| turn_on_led_using_webpage [2026/07/09 18:16] – [Introduction] walkeradmin | turn_on_led_using_webpage [2026/07/09 19:07] (current) – walkeradmin | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| ===== Introduction ===== | ===== Introduction ===== | ||
| \\ | \\ | ||
| - | I got the idea for this from this webpage [[https:// | + | I got the idea for this from this webpage [[https:// |
| \\ | \\ | ||
| \\ | \\ | ||
| - | |||
| In this example, we are going to turn on an LED on our Raspberry Pi Pico using a simple web page with two buttons. There is a second function where we can display the state of a hardware button also. | In this example, we are going to turn on an LED on our Raspberry Pi Pico using a simple web page with two buttons. There is a second function where we can display the state of a hardware button also. | ||
| \\ | \\ | ||
| Line 29: | Line 28: | ||
| \\ | \\ | ||
| \\ | \\ | ||
| - | {{ :corporate: | + | {{ : |
| In this example, we have the LED being connected to GP14 (pin 19) and GND (pin 18) via a 100 ohm resistor. You can use one of the GND pins on the Pico, or a common GND rail if you have made one. | In this example, we have the LED being connected to GP14 (pin 19) and GND (pin 18) via a 100 ohm resistor. You can use one of the GND pins on the Pico, or a common GND rail if you have made one. | ||
| Line 71: | Line 71: | ||
| \\ | \\ | ||
| \\ | \\ | ||
| - | {{ :corporate: | + | {{ : |
| Looking at the simulation above, we can see that when the button is not pressed, we get a delay of 1000mS as per the MicroPython code, so 1 flash every two seconds (1s on, 1s off). | Looking at the simulation above, we can see that when the button is not pressed, we get a delay of 1000mS as per the MicroPython code, so 1 flash every two seconds (1s on, 1s off). | ||
| Line 244: | Line 244: | ||
| \\ | \\ | ||
| \\ | \\ | ||
| - | {{ :corporate: | + | {{ : |
| \\ | \\ | ||
| The page clearly states that the Button is NOT pressed, and the LED is off. | The page clearly states that the Button is NOT pressed, and the LED is off. | ||
| Line 252: | Line 252: | ||
| \\ | \\ | ||
| \\ | \\ | ||
| - | {{ :corporate: | + | {{ : |
| \\ | \\ | ||
| You should see now that the page states that the button IS pressed and that the LED is on. | You should see now that the page states that the button IS pressed and that the LED is on. | ||
| Line 306: | Line 306: | ||
| \\ | \\ | ||
| \\ | \\ | ||
| - | {{ :corporate: | + | {{ : |
| \\ | \\ | ||
| You can now change the LED status on or off by simply clicking the buttons on the webpage, clicking either button also refreshed the webpage. This means, if you hold the button down (or not) and click a button to change the LED, the LED status will change, and the text at the bottom of the webpage will also change to reflect the button status. | You can now change the LED status on or off by simply clicking the buttons on the webpage, clicking either button also refreshed the webpage. This means, if you hold the button down (or not) and click a button to change the LED, the LED status will change, and the text at the bottom of the webpage will also change to reflect the button status. | ||
turn_on_led_using_webpage.1783621013.txt.gz · Last modified: by walkeradmin
