Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [data-type]

Identifies the size and nature of information held by a variable in a program. It is language-dependent. Examples for C/C++ include: `int`, `float`, and `char`.

Filter by
Sorted by
Tagged with
-2
votes
3answers
2k views

What Arduino data type allows decimals?

This probably sounds dumb, but I am not getting any clear answer for this. What data type allows a reasonable amount of decimals?
0
votes
2answers
1k views

Writing a float to a BLE characteristic. What data format?

I am currently working on a python-based Bluetooth Low Energy client for OS X and I got stuck while trying to write a remote float characteristic value. First of all: my setup is an Arduino 101 with ...
2
votes
2answers
167 views

How can i do something like multi threathing in arduino?

I am checking for ways to implement multi threathing in Arduino, I have also tried using the library TimerOne but it doesn't seem to work, what I'm trying to make is an Arduino application then, every ...
1
vote
1answer
1k views

What does 16u and 128u mean?

The below is a snippet of a code for operating SI4455 Rf module with Arduino. I have some doubts which I'd like to seek some help in clearing. byte numOfBytes = *pSetPropCmd++; if (numOfBytes &...
-1
votes
2answers
129 views

how to use an object of a class within that same class? [duplicate]

I want to write a tree data structure made up of Nodes, but I'm having a problem with my Node.h class as each Node need to have a reference Variable to other Nodes,it's children. which ends up giving ...
0
votes
1answer
479 views

Getting RGB values from camera

I have a camera I'm planning on attaching to an arduino uno, that I want to take pictures and extract the average RGB value from each image. This is the camera I have, but I've now realized that it ...
0
votes
1answer
4k views

error: invalid conversion from 'char' to 'char*' [-fpermissive]

I have written a simple code to read data from capacitive keypad and display it on LCD. I am getting the data from keypad in following data structure. char phoneNumber[PHONE_DIGITS]; and then ...
1
vote
0answers
81 views

incoming GSM data stored as variable in code [closed]

I am using an Arduino Mega board with a SIM900 GSM. My goal is to be able to text the GSM with a value of two digits (ex: 79) and then store that value as a variable in the code. I know how to set ...
0
votes
2answers
4k views

Convert uint8_t array to ascii character for serial transmission

I am trying to send packets of via bluetooth data that include 6 bytes read from a sensor and stored in a uint8_t array. Instead of sending over the data as numerical digital, I would like to send the ...
1
vote
0answers
318 views

How to get Type name of a variable on Arduino [duplicate]

I found this post and implemented the code in a separate classed and then passed different variables to it in an attempt to get the type name printed to serial. The code compiled and worked fine but ...
0
votes
3answers
1k views

A library for manipulate Intel Hex data?

For a project i need to extract some data from an external eeprom and then store it somewhere. Suddenly after some manipulations (not necessarly with Arduino board) i need to put them in an external ...
0
votes
2answers
63 views

How to properly process large arithmetic

just a question that requires a simple answer. How do I process a large number of arithmetic steps in arduino efficiently and precisely? For example I have this code function setup: void calc() { ...
0
votes
1answer
98 views

Simple Arduino Serial Arithmetic

I'm developing a program to calculate static margin of an aircraft through the calculations of mass,moment and arm. Essentially dealing with large numbers. I'm having difficulty in setting up my code ...
2
votes
2answers
5k views

Since double and float represent the same data type (usually), which is preferable?

It looks like on ATMega based boards, float and double are equivalent 32-bit (4-byte) data types. However, on the Arduino Due, doubles are 64-bit (8-byte) where floats are 32-bit (4-byte), same as ...
0
votes
4answers
3k views

Multiplication, division. What is wrong?

const unsigned long C1 = 30 * 1000; const unsigned long C2 = (300 * 1000)/C1; // must be = 10 void setup() { Serial.begin(57600); Serial.println("\n-------"); Serial.print("C1 = "); Serial....
3
votes
5answers
5k views

Serial.print() is slower than it should be

I'm trying to use Arduino as a DAQ but the Serial.print() is not working as fast as I expected. How many bits are sent if you are using a int, because if I use a uint8_t, it's taking the same amount ...
1
vote
1answer
2k views

Trouble with large numbers

Probably something stupid, but I can't figure out how to work with these large numbers, then cast the result (which will be small) to an integer. I keep getting negative numbers, which I think means I'...
1
vote
2answers
2k views

invalid conversion from 'char' to 'const char*'

My intention was to overload a function to handle optional parameters. My code looks like void functionA(const char *errorMsg) { functionA('0', errorMsg); } void functionA(char errorCode, const ...
2
votes
2answers
1k views

Arduino Variable Data Type?

Is there a variable data type available for Arduino? I have a class that should have a member that will differ in data type, in the past I have used the "variable" keyword in c++ but when I tried to ...
2
votes
4answers
3k views

Assemble or typecast byte array to float

The serial port on my Arduino Mega is receiving 3 floats as bytes (total of 12 bytes, 4 per float) over serial. Unfortunately I cannot assemble the 4 Bytes in a float, as the serial monitor only ...
1
vote
1answer
2k views

Cast from long to int

How does arduino uno cast from long to int? Does it truncate the bits? (Does it just delete the 16 most left bits?)
1
vote
1answer
1k views

Using union to return a range of bits from a data frame: wrong approach?

I'm working on an adaptation of Jason Leyrer's Guitar Hero Library for Arduino. My version is for a DJ Hero controller, and I've also borrowed some code from this Arduino forum thread: topic=120527 (...
0
votes
3answers
1k views

Having issues with Arduino + Bluetooth

I am working with a combination of Teensy++ 2.0 and Sparkfun Bluetooth Modem. The Arduino program, inside the loop, continuously reads a sensor value. If the value read is above a threshold, the ...
0
votes
1answer
641 views

Sending data from Processing and receiving as uint32_t

I need to send data from a processing sketch to an Arduino to pass to a function that takes a uint32_t. How to I send the data in Processing to be run on the Arduino
2
votes
3answers
1k views

Sending struct from Arduino to Raspberry Pi - wrong types

I'm using Raspberry Pi and Arduinos for my home automation project where Raspberry Pi is the controler of Arduino nodes. I use nRF24 wireless transceivers to communicate. My problem is that when I ...
0
votes
1answer
218 views

changing analog pins data logging using sdFat library

Background: My goal is to use sdFat library, more precisely AnalogBinLogger example. I want to log data from changing analog pins for example, I want to log from pin 0 to pin 3 for 5 minutes and ...
2
votes
2answers
6k views

Convert uint8_t array to uint32_t array

I have this array of bytes, that I need to convert to an array of unsigned ints. Also the function (btea) that needs it, seems to need a pointer. I'm currently using reinterpret_cast which seems to ...
1
vote
1answer
796 views

IR trouble with raw buffer

I am attempting to send a RAW IR code using the IRremote.h library. The process for capturing IR pulses is easy to find on the web, but the process for sending them again is not. After a few days, i ...
3
votes
2answers
309 views

Can I have help interperting this code? char variable somehow storing big numbers

I have this GSM module I got for my arduino project and I am trying to access the call feature, but the function makes no sense. boolean Adafruit_FONA::callPhone(char *number) { char sendbuff[35] ...
8
votes
3answers
9k views

arduino - millis()

Copied from the Arduino reference - millis() Tip: Note that the parameter for millis is an unsigned long, errors may be generated if a programmer tries to do math with other datatypes such as ...
2
votes
1answer
1k views

How to pass value of a function from the RFID-RC522 library into a variable then be sent into either serial or ethernet?

I'm using an RC522 RFID reader with an Arduino UNO. There is a function?? (or whatever it's called :)) in Miguel Balboa's new MFRC522.h library which is mfrc522.uid.uidByte[i] that prints the bytes of ...
1
vote
1answer
2k views

Modbus slave data into word

I have simple code. The library downloaded from github:smarmengol/Modbus-Master-Slave-for-Arduino. I wanted to store floating point. In the code blow, I type casted to integer value. As I know ...
0
votes
2answers
12k views

How to convert byte array to float

How can I convert a byte array to float? Code: void send_data() { CCPACKET data; data.length=2; float lon=26.533255; float lat=27.533463; data.data[0]=lon; data.data[1]=...
1
vote
1answer
1k views

square root of large number

I've got 2 int16_t numbers, say 388 and 10288, which are sensor readings from an accelerometer. I want to estimate the angle of the device on that, but seemingly there are some type overflow issues: ...
8
votes
2answers
28k views

How to retrieve the data type of a variable?

I am using Arduino and I would like to know if there is a function that returns the data type of a variable. That is, I would like to run something as like the following: // Note: 'typeof' is a ...
5
votes
3answers
5k views

How can I convert Arduino String to C string type?

I got a String which as I understand is an Arduino object, and got some C++ code: #include <Wire.h> #include <LiquidCrystal_I2C.h> #include <string.h> LiquidCrystal_I2C lcd(0x20,...
9
votes
2answers
3k views

Why is int only 2 bytes?

When using C/C++ on other platforms, the int type is typically 4 bytes (or potentially more). However, on Arduino, it's only 2 bytes. Why is it different? Does it affect performance if I always use ...