User Tools

Site Tools


turn_on_led_using_webpage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
turn_on_led_using_webpage [2026/07/09 18:16] – [Introduction] walkeradminturn_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://core-electronics.com.au/guides/raspberry-pi-pico-w-create-a-simple-http-server/|here]]. You can also watch a YouTube video about it [[https://www.youtube.com/watch?v=AK8UYh7pMGM|here]]+I got the idea for this from this webpage [[https://core-electronics.com.au/guides/raspberry-pi-pico-w-create-a-simple-http-server/|here]]. You can also watch a YouTube video about it [[https://www.youtube.com/watch?v=AK8UYh7pMGM|here]]. I decided to add it to my wiki site because (a) so many sites disappear these days and (b) I just wanted to try to add more comments to the code.
 \\  \\ 
 \\  \\ 
- 
 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:button-led-pico-003.png?500 |}}+{{ :button-led-pico-003.png?500 |}} 
  
 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:button-led-pico-004.mp4?480x360 |}}+{{ :button-led-pico-004.mp4?480x360 |}}
  
 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:button-led-pico-005.png?500 |}}+{{ :button-led-pico-005.png?500 |}}
 \\  \\ 
 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:button-led-pico-006.png?500 |}}+{{ :button-led-pico-006.png?500 |}}
 \\  \\ 
 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:button-led-pico-007.png?800 |}}+{{ :button-led-pico-007.png?800 |}}
 \\  \\ 
 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