Hi everyone!
I wanted to use python to take readings from Arduino. But I have a problems with taking the information from Arduino. Just for test the connection I did wrote small program. But it is still not working. Could you please help me?
The code I used in Arduino is :
#define READSOILPIN1 A0
void setup()
{
Serial.begin(9600);
pinMode(READSOILPIN1, INPUT);
}
void loop()
{
int SensorValue1=analogRead(READSOILPIN1);
Serial.print(SensorValue1); Serial.print(" - ");
delay(1000);
}
And the code in Python is:
import serial
arduinoData = serial.Serial('com8',9600)
while (1==1):
myData = (arduinoData.readline().strip())
print (myData.decode('utf-8'))