Skip to content
Die Applikation verwendet die REST API, weshalb es auch sehr einfach ist auf dessen Basis seine eigene Web Applikation zu schreiben. You might want to read Hi! Thanks again.I’m pretty new to all of this, and was wondering how would I need to alter this if I wanted to control multiple LED’s independently?In the last bit of code (the elifs) where it is looking for /on or /off, copy that if block and change those to something else, such as on2 off2, then change the gpio number (18 in the code) to where you connect the second led to the gpio.
In order to display the LED status, we use a little bit JavaScript code to inject the LED status based on URL endpoints to the HTML page.
finally: l = str(led) Fast you have to need to know how to Use the bottle Python web server library to create an HTML web interface. GPIO.setwarnings(False)
response += html_for_led(2) @route('/') how can I control more than one pin with the same code?? Very useful.I was wondering if I could use this example to control the GPIO from anywhere in the world, not just in mi WLANYes, provided you setup your server to allow external traffic to come in. The remaining pins are all general purpose 3V3 pins, meaning outputs are set to 3V3 and inputs are 3V3-tolerant. @route('/') This will increase the complexity in parsing the uri into different parts, but it allows you to control as many devices as possible.Please I need more explanation on how to run the web page. When sending the web request, /on will control one and /on2 will control the second.Sorry, not the entire if block, just the elifs for copying… Autocorrect got meBut when I Run the python script in the terminal with the following command:Problem solved! return result I already identified the extra pins needed for my code as outputs.also how can I change this code and use it to control the pi cameraScroll up to Comment 3 where reader @Tutoro offers a simple solution to the question. Das kommt daher, dass die Bibliothek leider nicht den Output Zustand der GPIOs auslesen kann. We replace the HTML form and the on/off buttons with two links. led_states[led_num] = not led_states[led_num] Our new code is a little bit simpler without do_POST() method. 2 Kommentare Roland Berndt sagt: 17. Control Raspberry Pi GPIO using python http.server library . Ces broches peuvent assurer différentes fonctions mais sont uniquement de type numérique : 1. I’ve almost made it work, buuuut…not at all.Do you have an idea of what must be happening? Our new code is a little bit simpler without do_POST() method. else: EPICENTER Send an email. Raspberry Pi Web Interface: These are the instructions to installing the web interface I developed for toggling the gpio pins of a raspberry pi in order to control an active low relay board desinged for arduino. def html_for_led(led): response = "