The following shows how to interact with a light with Python code using a Raspberry PI with a GPIO (general purpose input output) board. It is a very simple example but all sorts of senors and motors can also be attached and controlled in a similar way.
![](https://static.wixstatic.com/media/f56d19_7ba9a2d18c724e4f9a809595c4621e8d~mv2.jpg/v1/fill/w_980,h_454,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/f56d19_7ba9a2d18c724e4f9a809595c4621e8d~mv2.jpg)
Then running some code to turn on and off the light:
![](https://static.wixstatic.com/media/f56d19_954aa304ee0e437c876f5fe5fa3fbf75~mv2.jpg/v1/fill/w_602,h_433,al_c,q_80,enc_auto/f56d19_954aa304ee0e437c876f5fe5fa3fbf75~mv2.jpg)
Then light light will turn on for 2 seconds:
![](https://static.wixstatic.com/media/f56d19_3ad6dc039b8c453f8d16bff270d27d35~mv2.jpg/v1/fill/w_836,h_420,al_c,q_80,enc_auto/f56d19_3ad6dc039b8c453f8d16bff270d27d35~mv2.jpg)
And off for 2 seconds:
![](https://static.wixstatic.com/media/f56d19_cb973df28b5c4cb08bca1bf01228432c~mv2.jpg/v1/fill/w_779,h_454,al_c,q_80,enc_auto/f56d19_cb973df28b5c4cb08bca1bf01228432c~mv2.jpg)
Next Steps:
Connect a servo (motor) and a sensor
Comments