Traceback (most recent call last):

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 :

void setup()

void loop()
int SensorValue1=analogRead(READSOILPIN1);
Serial.print(SensorValue1); Serial.print(" - ");

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'))

Your python code tries to read lines ending in a '\n', but your Arduino code is writing a single neverending line. Put Serial.println() somewhere.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.