Create raspi_serial.py
This commit is contained in:
parent
3acffedafc
commit
186d28ccf4
1 changed files with 16 additions and 0 deletions
16
raspberrypi/raspi_serial.py
Normal file
16
raspberrypi/raspi_serial.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import time
|
||||||
|
import serial
|
||||||
|
|
||||||
|
ser = serial.Serial('/dev/ttyACM0', 9600)
|
||||||
|
|
||||||
|
# read Arduino
|
||||||
|
|
||||||
|
while True:
|
||||||
|
|
||||||
|
input = ser.readline()
|
||||||
|
|
||||||
|
input_number = input
|
||||||
|
|
||||||
|
print ("Time: " + str(int(time.time())) + " Reflection Value: " + str(input_number)[:-2] + "[v]")
|
Reference in a new issue