Skip to main content

Questions tagged [variables]

Variables are used to store data in a sketch/program.

24 votes
4 answers
5k views

Why do people use a variable to specify a pin number when the pin is unlikely to change throughout the execution of the code? Many times I see an int being used for a pin definition, int led = 13; ...
Greenonline's user avatar
  • 3,152
19 votes
5 answers
191k views

I'd like to make three arrays of the same length. According to the documentation, Arrays must be defined as int myArray[10]; where 10 can be substituted for a known length (another integer), or filled ...
user3.1415927's user avatar
14 votes
5 answers
82k views

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 ...
user502052's user avatar
11 votes
1 answer
43k views

This question is quite clear. What are the differences between an int, an uint8_t, and an uint16_t. I know it has to do with bytes and memory but can someone clarify me a bit? Things I want to know: ...
Dat Ha's user avatar
  • 2,943
10 votes
2 answers
5k views

I've scoured the LANGUAGE REFERENCE in the Arduino web-site, and I can't find a non-Float equivalent to pow() I've got to be missing something big, but for the life of me, I'm stumped! I found pow() ...
user avatar
9 votes
2 answers
4k views

I'm trying to check the frequency of Timer3 using a counter. The value of the counter, declared as volatile, is incremented in the ISR and every second the sum is shown in the main loop and the value ...
UserK's user avatar
  • 559
7 votes
2 answers
3k views

I am doing a project where, for troubleshooting reasons, I find myself often swapping components to different serial ports. Maybe one time it's in Serial, then in Serial1, maybe I need to try if ...
metichi's user avatar
  • 181
6 votes
1 answer
3k views

On an embedded system we use global variables often to keep dynamic memory consumption on heap and stack low. But global variables are also considered bad programming practice if they aren't used in a ...
Ariser's user avatar
  • 577
5 votes
3 answers
1k views

I set out to see how much space some arrays have. I used this test code bool state = false; uint16_t BuffA[46000]; uint16_t BuffB[20000]; uint16_t BuffC[20000]; uint16_t all = 0; void setup(){ ...
user1584421's user avatar
  • 1,435
5 votes
3 answers
36k views

I'm trying to store a state in my data logger. I can read/write fine to SD, but I can't wrap my head around reading/writing a long value correctly - I've build it down to converting it to char array ...
Blitz's user avatar
  • 155
5 votes
6 answers
20k views

I'm very new to Arduino and I am making a code for a pedometer. I have a lot of variables and I have used "int" multiple times, but I just came across a code with "float". Now because my coding ...
user30763's user avatar
5 votes
1 answer
2k views

Basic question: How far do I have to go to assure that integer math is done correctly? For example, this is probably overdone: unsigned long burnTime = 0UL; unsigned long curBurnTime = 0UL; // Do ...
bluesmoke's user avatar
4 votes
2 answers
1k views

I'm trying to make my Arduino Uno control the air conditioner by recording the raw IR signal of several of the AC remotes temperatures using AnalysisIR. However these IR codes are quite long (array ...
ihish52's user avatar
  • 41
4 votes
2 answers
103 views

I've wired up a dot matrix, and I display characters on the screen by using something like the example code below. The Char_B variable is a global variable in a library used by the Arduino, and ...
user16869's user avatar
4 votes
2 answers
4k views

I want to use the Ticker library of the ESP8266 Arduino core to (asynchronously) delay the switch of a pin to a desired state like below. I am not sure about the "here is" function definitions and I ...
milkpirate's user avatar

15 30 50 per page
1
2 3 4 5
11