Skip to content

parseFloat is not able to parse positive float numbers #8782

Closed
@deepparikh

Description

@deepparikh

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);
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions