boolean |
1 byte |
true or false |
boolean ledState = true; |
ON/OFF conditions |
bool |
1 byte |
true or false |
bool buttonPressed = false; |
Same as boolean (standard C++) |
byte |
1 byte |
0 to 255 |
byte ledPin = 13; |
Pin numbers, small positive values |
char |
1 byte |
Single character |
char grade = 'A'; |
Letters and symbols |
unsigned char |
1 byte |
0 to 255 |
unsigned char count = 200; |
Small positive numbers |
int |
2 bytes |
-32,768 to 32,767 |
int sensorValue; |
Most whole numbers |
unsigned int |
2 bytes |
0 to 65,535 |
unsigned int rpm; |
Larger positive numbers |
word |
2 bytes |
0 to 65,535 |
word address = 5000; |
Same as unsigned int |
long |
4 bytes |
-2,147,483,648 to 2,147,483,647 |
long duration; |
Large whole numbers |
unsigned long |
4 bytes |
0 to 4,294,967,295 |
unsigned long previousMillis; |
Timing with millis() |
float |
4 bytes |
Decimal numbers |
float distance = 12.5; |
Measurements with decimals |
double |
4 bytes* |
Decimal numbers |
double pi = 3.14159; |
Same as float on Uno/Nano |
String |
Variable |
Text strings |
String name = "Arduino"; |
User messages, text |
void |
No storage |
No value |
void setup() |
Functions that return nothing |