A datatype in C/C++ which stores a single-precision floating point number.

learn more… | top users | synonyms

8
votes
2answers
730 views

Is there a non-float alternative to pow()?

I've scoured the LANGUAGE REFERENCE in the Arduino web-site (https://www.arduino.cc/en/Reference/HomePage), and I can't find a non-Float equivalent to pow() I've got to be missing something big, but ...
1
vote
1answer
62 views

Help avoiding floating point math

I'm using a Texas Instruments DRV2605 haptic controller in my project to drive a LRA vibration motor. I would like to calculate the LRA rated voltage during run time using the formula below as ...
0
votes
1answer
90 views

Fastled int + float problem

I'm working on a code based on PaletteCrossfade.ino example. But i found the motion speed too fast. its stated in this: static uint8_t startIndex = 0; startIndex = startIndex + 1; /* motion speed ...
1
vote
2answers
945 views

How do I convert a float into char*?

Asked this question on Electrical Engineering Stack Exchange and was directed here: Pretty self explanatory; how would I go about converting a float into a char*? I have code in which the float '...
0
votes
1answer
58 views

Can anyone help me spot where my buffer overflow might be occuring?

I'm using dtostrf() to transcribe a float into a string for my touchscreen. I'd leave it as a float, but my screen orientation library function only works with a string. So I have a char array, then ...
0
votes
1answer
117 views

Max double value or NAN as a sentinel value?

I am in need of a sentinel value to use to assign to a double variable initially. 0 or -1 won't work because these values are valid values in my computation and I need a value that will stand out. ...
0
votes
1answer
55 views

build fixed size strings from floats

This is likely a duplicate, but I couldn't find the original question. This is really basic, but just can't figure it out. I'm trying to combine a few char arrays together. This is what I've tried so ...
1
vote
2answers
368 views

Avoiding float math to speed up arduino

I read and heard that the floating point math is much slower than int math. And I saw a converting process in here floath math to integer math So I want to to convert my floating math calculations ...
0
votes
1answer
305 views

DS18B20 Temperature Sensor return as float function returning null 50% of the time

I just got an DS18B20 Temperature sensor and am trying to modify the example code to use a function instead. Below is my getTemp function. It's working but returning results with a 0 value part of the ...
1
vote
1answer
67 views

How to speed up

I found that using more float variable in arduino uno(atmega328p) slows it down (very muck that i can get slow response) so, how to speed up it processing ? my data are euler's angle with 2 digits ...
0
votes
1answer
272 views

How to append float value of into a string ?

I have a float variable lng = 33.785469 and lat = 78.126548. Now can I convert them to String and append in a String variable "my_location" as "your location is \nlng = 33.785469 \nlat = 78.126548". I ...
0
votes
1answer
326 views

Store TinyGPS++ latitude value into a variable of type string or float

I want to get the GPS ordinates in degrees with 6 decimal accuracy. I can obtain this by creating a gps object with TinyGPS library. but In the TinyGPS example codes, its written Serial.println(gps....
0
votes
1answer
36 views

Problem assign float to an embed class within the Linked-list libary

I have successfully implemented some code which uses a linked-list. Everything is working, except assigning a value to a float within the embeded class. When I run the code below, I get the expected ...
0
votes
3answers
1k views

How to cast float into four bytes?

I'm trying to save GPS coordinates to an EEPROM. In this example I feed it the latitude of 56060066 as the argument float x void writeFloat(unsigned int addr, float x) { byte seriesOfBytes[3]; *(...
2
votes
2answers
10k views

Sending and receiving different types of data via I2C in Arduino

I have found a few good tutorials on how to send and receive data via I2C in connected arduinos. My limitation is now how to transmit different types of data like for instance, long, float, etc. Right ...
1
vote
4answers
224 views

Float arithmetic vs. int arithmetic - is there any power penalty?

It is widely known that float arithmetic takes longer (that is, eats more cycles) than fixed-point (or integer, or bitwise arithmetic), and that surely is something to consider for speed- and time-...
1
vote
1answer
187 views

Assembling a float from an array of bytes

I would like to convert an array of bytes, received from serial, to a float. Let's consider this exemple. I'm sending 0.12 byte-wise from an Android application. The conversion from float to array of ...
3
votes
2answers
217 views

Store floats in and reading them from flash

How do I store floats in flash and how do I read them from there? (I need a look-up table for pairs of float values.) The storing part doesn't seem to be so difficult as this compiles: PROGMEM float ...
1
vote
2answers
6k views

float precision in arduino

I am reading a string which i have to convert into a float with a maximum of precision.I didn't want to use toFloat() function since it make a truncation so i made my own code. My problem is that the ...
1
vote
1answer
595 views

Read data from SD

I have logged some data in my sdcard/FAT32 (format). I can read and display them on the serial monitor but additionally I want to use these data as float. Here is my code: byte index = 0; ...
0
votes
1answer
99 views

Serial, Numbers sent as Floating Point and Characters are different at 1e-8 level

I have some code that generates random numbers on the Arduino, it then sends these random numbers firstly, using Serial.print(float data,int lenght) and as a floating point number using the following ...
1
vote
0answers
22 views

Local variables scope anamoly

I have this simple function that produces 2 float values sum and product from which i calculate another varaible NodePrio. I had the value of NodePrio coming wrong so i decided to put in some console ...
0
votes
1answer
255 views

Saving data in a globally declared float array

I'm trying to send 60 float values via serial. Numbers are provided by an accelerometer and saved in a 240 bytes-long array. The array is sent to a function and these values are then copied in a ...
0
votes
2answers
1k views

Sending a floating point number from python to arduino

I am trying to send a floating point number from a python script to an Arduino. I am not sure how to do this, especially in a pythonic way. A little bit of research brought me to this very similar ...