Arduino Cheat Sheet - Mark Liffiton 2024-02-14
Arduino Cheat Sheet - Mark Liffiton 2024-02-14
Arduino Cheat Sheet - Mark Liffiton 2024-02-14
https://www.arduino.cc/reference/en/
int1
int0
Data Types Numeric Constants Wire.h - I²C communication
SCL
SDA
(40mA max per I/O pin)
bool true | false 123 decimal begin() // Join a master
char -128 - 127, 'a' '$' etc. 0b01111011 binary begin(addr) // Join a slave @ addr
0173 octal - base 8 requestFrom(address, count)
2
13
12
~9
~6
~5
~3
GND
~11
~10
AREF
TX→1
RX←0
unsigned char 0 - 255
byte 0 - 255 0x7B hexadecimal - base 16 RESET DIGITAL (PWM~) beginTransmission(addr) // Step 1
int -32768 - 32767 123U force unsigned send(byte) // Step 2
L
unsigned int
word
0 - 65535
0 - 65535
123L
123UL
force long
force unsigned long
ARDUINO UNO send(char * string)
send(byte * data, size)
TX ON
long -2147483648 - 2147483647 123.0 force floating point RX endTransmission() // Step 3
unsigned long 0 - 4294967295 1.23e6 1.23*10^6 = 1230000 ICSP int available() // #bytes available
float -3.4028e+38 - 3.4028e+38 1 byte receive() // Get next byte
Qualifiers onReceive(handler)
double currently same as float
static persists between calls onRequest(handler)
void return type: no return value
volatile in RAM (nice for ISR)
const read-only WWW.ARDUINO.CC - Made in Italy
Strings
PROGMEM in flash ATmega328P:
char str1[8] = 16MHz, 32KB Flash (program), by Mark Liffiton
{'A','r','d','u','i','n','o','\0'}; Arrays 2KB SRAM, 1KB EEPROM version: 2024-02-14
// Includes \0 null termination byte myPins[] = {2, 4, 8, 3, 6};
char str2[8] = int myInts[6]; // Array of 6 ints DC in POWER ANALOG IN source: h�ps://github.com/liffiton/Arduino-Cheat-Sheet/
IOREF
RESET
A0
A1
A2
A3
A4
A5
// Compiler adds null termination // index of myInts limit 6-20V - Original: Gavin Smith
char str3[] = "Arduino"; myInts[6] = 12; // ERROR! Indexes - SVG version: Frederic Dufourg
char str4[8] = "Arduino"; // are 0 though 5
SDA
SCL
- Arduino board drawing: Fritzing.org