-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Float problem #42
Comments
Without looking at your code, you're most likely not using 32 bit floats on the Arduino side. If you replace |
Yes, my mistake, is fact. Raw example generate like this: Arduino: #include <Arduino.h> HardwareSerial Serial2(PA3,PA2); SerialTransfer myTransfer; struct STRUCT { char arr[] = "hello"; void setup() { analogWriteResolution(12); pinMode(LED_BUILTIN, OUTPUT); testStruct.z = '$'; } void loop() { // use this variable to keep track of how many ///////////////////////////////////////// Stuff buffer with struct ///////////////////////////////////////// Stuff buffer with array ///////////////////////////////////////// Send buffer testStruct.y = testStruct.y + 0.1; digitalWrite(LED_BUILTIN, LOW); } Python: from time import sleep class struct(object): arr = '' if name == 'main':
|
I've fixed the examples and will tag out a new version soon. |
Ok, find where is problem, im don`t know is the platform STM32/ARDUINO or python issue - but difference bet wen sides is |
The issue isn't on either side, it's how you use the libraries. Python's normal float size is 32 bits and Arduino's normal float size is 16 bits. If you use doubles on the Arduino side, or 16 bit floats on the Python side, you'll be good to go |
Yes im lost 2 days :) for that, mega good library for me. |
Hi im got a problem with float on python side (RX), got a this kind of output: b'P'2.1579996350602183e-43
When im sending from uC:
testStruct.z = 'P';
testStruct.y = 4.55;
Betwen uC is no problem work like a harm, on python floats crazy.
9600 baud / Python 3.9.2 / Debian
The text was updated successfully, but these errors were encountered: