Skip to content
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

parseFloat is not able to parse positive float numbers #8782

Closed
5 of 6 tasks
deepparikh opened this issue Jan 3, 2023 · 0 comments · Fixed by #8785
Closed
5 of 6 tasks

parseFloat is not able to parse positive float numbers #8782

deepparikh opened this issue Jan 3, 2023 · 0 comments · Fixed by #8785

Comments

@deepparikh
Copy link

deepparikh commented Jan 3, 2023

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: Adafruit Feather HUZZAH ESP8266
  • Core Version: [latest git hash or date]
  • Development Env: Arduino IDE
  • Operating System: Windows

Settings in IDE

  • Module: Generic ESP8266 Module
  • Flash Mode: [qio|dio|other]
  • Flash Size: [4MB/1MB]
  • lwip Variant: [v1.4|v2 Lower Memory|Higher Bandwidth]
  • Reset Method: [ck|nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [160MHz]
  • Upload Using: [SERIAL]
  • Upload Speed: 11520

Problem Description

parseFloat is not able to parse positive float numbers

Detailed problem description goes here.
I want to send float numbers from Arduino UNO to ESP8266. I2c was my first choice but unfortunately ESP8266 does not support receiver mode and I can not make ESP8266 master as there are time critical threads running on UNO and when it is free, it sends telemetry data to ESP8266.

Hence, I am attempting to receive data using serial and parseFloat. However, the parser is not able to parse the positive float numbers and also does not allow me to modify the SKIP parameters.

Any help would be greatly appreciated.

Sender Code : (Arduino UNO)

void setup()
{
  Serial.begin(115200);
}

float x = 157.50;

void loop()
{
  // Start the packet
  Serial.print(x);
  x++;
  delay(100);
}

Receiver Code : (ESP8266)

#include <Arduino.h>
#include <Stream.h>

void setup() {
  Serial.begin(115200);
}

void loop() {
  if (Serial.available() > 0) {
    float myFloat = Serial.parseFloat();

    //prints the received float number
    Serial.print("I received: ");
    Serial.println(myFloat);
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants