Imgur: The magic of the Internet <---link to what I am getting
Hi there, its my first time posting here, I have the following problem. The data I am sending is getting read very weirdly, as you can see on the screenshot . The code I use to take the readings is this:
This code is taking readings from load cells(Its taken from SparkFun).
#include "HX711.h"
#define calibration_factor -7050.0
#define DOUT 3
#define CLK 2
HX711 scale(DOUT, CLK);
void setup() {
Serial.begin(115200);
//Serial.println("Scale Test");
scale.set_scale(calibration_factor);
scale.tare();
//Serial.println("Reading: ");
}
void loop(){
Serial.print("Reading: ");
Serial.print(scale.get_units(), 1);
Serial.print(" kg");
Serial.println();
delay(1000);
}
and use this code to read the data from the serial port:
import serial
import time
def Read_Weight():
while 1:
ser = serial.Serial(
port='/dev/ttyACM0',
baudrate = 115200,
bytesize = serial.EIGHTBITS,
parity = serial.PARITY_NONE,
stopbits = serial.STOPBITS_ONE,
xonxoff = False,
rtscts = False,
dsrdtr = False,
timeout = 1
)
#force = False
data = ser.readline()
return data
#while 1:
# x = ser.readline()
# print x
My question is, whats the reason for the data being sent being so random and corrupted? Random letters are being removed, or added. Is it because the code on Arduino is in different language than the one on raspberry pi? I am sorry if its something obvious but I am very green in all this. ![]()
