Python Forum

Full Version: Code to use output from arduino as input (help)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As you may have gathered from the title, I have no idea what I am talking about. I spent all of 10 minutes trying to come up with the title and that is all I could say. I have little to no experience with python but for some reason, I am required to use it for a project in one of my classes. after searching for hours I thought that this might be the best place to ask something like this. Please have mercy on my soul for being brain-dead in this field. I am a first year and have very little clue what I am doing.

Now on to the problem. I have a project I need to make with a Raspberry Pi and an Arduino. Basically, I have to make a security system with a laser transmitter and sensor. If the sensor detects the laser, it will return a HIGH output and when it detects no laser it will output LOW. This device connects to the Arduino and can be monitored through USB connection by a Rasberry Pi (basically using the Arduino as a slave to run to code and return the values from the sensor). Then I need to process to code somehow so that I can use it to send an email automatically using ssmtp. This is where my problem lies. I have 0 clues how to grab the output of the Arduino and to input it to a code to send an email. This process needs to be all automatic so my best guess is I have to somehow create a loop that checks every couple of seconds whether or not the laser is detected or not. Then use that value to determine whether or not to send the email.

I can't think of any way to do this (just because I have very little idea of how python works) and thus haven't really thought of anything to try as of yet.

Please, any information can help, I appreciate from the bottom of my hearts anything contributed. Thanks! Heart Smile