Here is my code:
import serial ser = serial.Serial('/dev/ttyAMA0') x = 0 while x <= 30: ser.read(ser.inWaiting()) opc_data = ser.read() print opc_data x = x+1
When I run this code, nothing is printed to the console for the most part, but every once in a while a digit shows up like a 1, 2, f, or g
What I am expecting to get is two numbers, one around 1800 and one around 20. My question is: why are the numbers I am expecting to see not showing up? Is there an issue with the code? or Is it an issue with the OPC that is sending the RPi data? or something else?
Edit: inWaiting "gets the number of bytes in the input buffer" and it "returns the number of bytes in the receive buffer" as an int.
Edit: Pi model: A, OS: Raspbian wheezy, Baud rate: 9600