Since the environment of the client-server-target is currently quite functional in the messaging standpoint, I decided to try connecting a simple LED light to the Raspberry Pi to see if it could "open" a door when the command is received.
Installed the RPi.GPIO module (a Python module that gives the user command of the GPIO--General-Purpose Input/Output--ports in the Raspberry Pi) and connected the LED light to a GPIO pin. When the target received a request message, it would signal the GPIO pin to drive a current to the LED to light it up for 2 seconds.
in main:
if __name__ == "__main__":
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
in the on_message's request-received logic:
GPIO.output(17, True)
time.sleep(2)
GPIO.output(17, False)
The video is a weak visual result. You can a click when the LED lights up; that was the sound of the key being pressed that sent the request message.
Now, time to get (think up of ) some actuators that can do what I want to do.
Comments
Post a Comment