Questions tagged [variables]
Variables are used to store data in a sketch/program.
162 questions
1
vote
2
answers
7k
views
How to display float variables on oled display (0.96'')
I have a similar problem than the discussed here : How to display variables on 0.96" OLED with u8glib library?
I'd like to know how can I show float variables in place of int variables. What ...
-2
votes
1
answer
81
views
How do I change what variable I am changing based on a separate number?
I am trying to change thing2 if I input 0, and thing3 if I input 1. I don't want to just have if/else to determine if I should be changing thing2 or thing3 because I want this to be more dynamic than ...
1
vote
1
answer
4k
views
Variable declared inside void setup() is forgotten in void loop()
If I declare a variable in void setup() and try to do something with it in void loop(), it just says that the variable is undeclared. Here is the code:
#include "Servo.h"
void setup() {
...
-1
votes
1
answer
363
views
Declaration of global variables in separate file: compiler conflict
So I have:
1/ My myapp.ino file, that includes src.h (implemented in src.cpp). Compiled for Arduino Uno.
2/ I also have a unit-tests.cpp file that is meant to test functions in src.cpp. Compiled for ...
-1
votes
1
answer
958
views
Multiple definition error in STM32CubeIDE
How do global variable declarations work?
For example:
In file1.c I am defining:
#define volt_add 0x20
uint8_t vol[8]= {0x53, 0x35, 0x05, 0x22, volt_add,0x00,0x00,0x00};
uint16_t EM_vol;
I need to ...
1
vote
2
answers
114
views
converting comma delimited Serial message to 7 Unsigned Long variables
Working on a project where I get an input where its a comma delimited string like:
"255,10000000,42949672950254,12,22".
and then the numbers (no commas), would be split into 6 Long ...
0
votes
1
answer
1k
views
how to "skip" one parameter of a method with a default value letting it use it's default value, but change parameters after it [closed]
lets say we have a function like this(fictional):
function1(int Z, int X, bool Y=true, int Count=10, int ID=1,bool TeaTime=false);
And I want to run this function, but I want to change all parameters,...
14
votes
5
answers
82k
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 ...
0
votes
2
answers
314
views
IsTimeSet library - Assign variables
i get the current time with the example code istimneforset, everything works fine.
now i want to get the current time from the function "Serial.println(timeClient.getFormattedTime());" and i ...
1
vote
1
answer
280
views
Conditional assignment of array
I have some really long global variable arrays filled with data.
There is a single function that processes the data. The function works on only one array everytime. This arrays value changes every ...
1
vote
1
answer
528
views
Change/declare a constant in setup and use it in loop
I want to change or declare a constant in the setup() and then, I want to access it in the loop().
I have searched a lot, but the only questions I found could be solved by declaring the constant in ...
0
votes
1
answer
261
views
What's the difference between CloudTemperature, CloudTemperatureSensor and Float data types?
I have a SHT30 sensor for Wemos and I am learning to use Arduino IOT Cloud.
I use float data type for my temperature variable but I see two more data types:
CloudTemperature
CloudTemperatureSensor
...
1
vote
1
answer
2k
views
nRF52 non-volatile storage/recall of a variable - is there a simple solution?
I have an Arduino program written for the nRF52 with which runs for a pre-set time-value (i.e. 2 minutes) before shuts off automatically. The variable time-value can be changed via BLE-write by the ...
0
votes
1
answer
95
views
Wrong use of memory?
Probably I'm doing something wrong.
I'm writing an Arduino sketch for ESP32.
Among the others I have this function:
#define HDR_MAX_LENGHT 4
#define CMD_MAX_LENGHT 5
#define ARG_MAX_LENGHT 5
#define ...
-2
votes
1
answer
851
views
how to save float with 3 decimal places [duplicate]
i am transmitting sensor data from my atmega328p to my esp8266. The Sensordata has 3 decimal places. The esp8266 sends this data to my pc and there I see only two digits. This is because the data is ...