
BeagleBone By Example
By :

Now we have set up the circuit from the previous topic, we will code it on Python to switch the GPIO to HIGH and LOW from the web page. You can proceed and write the code as shown in the following screenshot:
Now save the file as GPIOControlWebApp.py
.
Let's run the code to switch the lamp on and off, and go ahead and open the page from the Android tablet. The tablet is connected to the same LAN Wi-Fi router as the BeagleBone board. Click the on and off buttons and you will see the output in the shell terminal as shown in the following screenshot:
And the bulb will turn on and off as shown in the following pictures:
Bulb is in the off state
Bulb is in the on state
But right now, we are just doing this on our local network within our home router LAN network to which the BeagleBone board is connected. What if we wanted to control the bulb via a 3G connection available on our phone? In this case you need...