Aug-26-2018, 02:42 PM
Hi guys. So, I am trying to receive serial data from my Arduino Uno.
The Arduino sends the heading from a magnetometer over serial, but the Python code does not receive it.
This is my Python code:
The Arduino sends the heading from a magnetometer over serial, but the Python code does not receive it.
This is my Python code:
import serial Arduino = serial.Serial("COM3", baudrate = 9600) # serial device angle = 0 Compass() #This function draws the compass while (True): try: flushInput() angle = Arduino.readline() angle = angle.strip() angle = int(angle) compasspointer.settiltangle(-angle+90) #update heading print(angle) except: passMy Arduino code:
void setup() { Serial.begin(9600); } int heading=105;//just a value void loop() { Serial.println(heading);thanks for your help!