Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
67 views
1 page
Arduino Cheat Sheet 1-En
Uploaded by
shiladey709
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Download
Save
Save Arduino Cheat Sheet 1-En For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
67 views
1 page
Arduino Cheat Sheet 1-En
Uploaded by
shiladey709
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Arduino Cheat Sheet 1-En For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save Arduino Cheat Sheet 1-En For Later
You are on page 1
/ 1
Search
Fullscreen
ARDUINO PROGRAMMING CHEAT SHEET
SKETCH OPERATORS BUILT-IN FUNCTIONS
Basic Sketch Structure Arithmetic PIN INPUT/OUTPUT Math
void setup() { = assignment Digital I/O min(x, y); max(x, y);
// runs once after each powerup or reset + addition pinMode(pin, mode); abs(x); - Absolute value
} - subtraction mode - INPUT, OUTPUT, INPUT_PULLUP sin(rad); cos(rad); tan(rad);
* multiply / divide int digitalRead(pin); sqrt(x); pow(base, exponent);
void loop() { % modulo digitalWrite(pin, state); constrain(x, min, max);
// runs continuously state - HIGH, LOW map(val, fromL, fromH, toL, toH);
} Comparison
== equal to Analog I/O External Interrupts
Function Definitions != not equal to int analogRead(pin); attachInterrupt(interrupt, ISR,
<ret. type> <func. name>(<param. type> <param. name>){ … } i.e.: < less than analogReference(source); mode);
float circleCircumference(int radius) { return 3.14 * 2 * radius; } > greater than source - DEFAULT, INTERNAL, EXTERNAL mode - LOW, CHANGE, RISING,
void printGreeting(string name) { Serial.println(name); } <= less than or equal analogWrite(pin, value); //PWM FALLING
>= greater than or equal detachInterrupt(interrupt);
Advanced I/O interrupts();
Boolean tone(pin, freq_hz); noTone(pin); noInterrupts();
VARIABLES, ARRAYS, DATA TYPES && and tone(pin, freq_hz, duration_ms);
|| or byte shiftIn(dataPin, clkPin, order); Type Conversions
Data Types Strings
! Not shiftOut(dataPin, clkPin, order, val); char(val); byte(val);
bool/boolean true false char ex1[3] = {`H’,’i’,’\0’};
bitOrder - MSBFIRST, LSBFIRST int(val); word(val);
char -128 - 127 char ex2[3] = {H’,’i’};
Compound Operators unsigned long pulseIn(pin, state, long(val); float(val);
unsigned char 0 - 255 char ex3[] = „Hi”;
++ increment -— decrement timeout); //timeout parameter optional
byte 0 - 255 char ex4[3] = „Hi”;
+= addition -= subtraction pulseInLong //same as pulseIn Random Numbers
int -32768 - 32767 *= multiplicat. /= division randomSeed(seed);
unsigned int 0 - 65535 Qualifiers
Bits and Bytes long random(max); //min = 0
word 0 - 65535 static //persists between func. calls
Bitwise operators byte lowByte(x); byte highByte(x); long random(min, max);
long -2147483648 - 2147483647 volatile //in RAM (good for ISR)
& and byte bitRead(x, bitnumber);
unsigned long 0 - 4294967295 const //read-only
| or bitWrite(x, bitnumber, bit); Time
float -3.4028e+38 - 3.4028e+38 PROGMEM //stored in flash
^ xor bitSet(x, bitnumber); unsigned long millis(); //<50 days
double - same as float except Due ~ not bitClear(x, bitnumber); unsigned long micros(); //<70 mins
void - indicates no return value Numeric Constants
<< shift left bit(bitnumber); delay(miliseconds);
123 decimal
>> shift right delayMicroseconds(useconds);
Arrays 0b01111110 binary
int even[] = {2, 4, 6, 8}; 0123 octal - base 8
Compound bitwise operators
int pins[6]; 0xA2 hexadecimal
123U force unsigned
&= compound bitwise and ARDUINO LIBRARIES
pins[0] = 10; //indexing from 0 |= compound bitwise or
pins[6] = 7; //Common mistake - 123L force long Serial - communication via UART Wire.h - I2C communication
indexing from 0 to size - 1 !!! 123UL force unsigned long begin(long speed); begin(); //join a master
Pointer Access
123.0 force float end(); begin(addr); //join a slave
& reference: get a pointer
1.23e6 1.23*10^6 int available() //num. of bytes requestFrom(address, count);
* dereference: get a value
available setClock(clkFreq);
int read(); //-1 if none available beginTransmission(addr);
int peek(); //read without removing write(byte)
CONTROL STATEMENTS flush(); write(char* str);
if (x > 0) { … } else { … } print(data); println(data); write(byte* data, length);
switch (x) { write(byte); write(char* str); byte endTransmission();
write(byte* data, size); int available(); //no. of bytes
case 1: Author: Michał Zięba serialEvent(); byte read(); //get next byte
… Adapted from: Mark Liffiton
break; onReceive(handler);
case 2: EEPROM.h - non-volatile memory onRequest(handler);
www.przygodyzkodem.pl byte read(address);
…
break; GITHUB: przygodyzkodem write(address, byte); Servo.h - control servo motor
default: IG: przygodyzkodem put(addr, data); get(addr, data); attach(pin, min_us, max_us);
… FB: przygodyzkodem EEPROM[index]; //access as array write(angle); //0 to 180
break; writeMicroseconds(useconds);
} SoftwareSerial.h - UART on any pin //1000 - 2000; 1500 is midpoint
while (x < 10) { … } SoftwareSerial(rxPin, txPin); int read(); //0 to 180 angle
for (int i = 0; i < 10; i++) { … } bool listen(); //only 1 can listen bool attached();
do { … } while (x < 10); Attribution-ShareAlike 4.0 bool isListening(); detach();
break; //Exit loop/switch immediately International (CC BY-SA 4.0) begin, read, peek, print, println,
continue; //Go to next iteration start write, available //As in Serial lib.
You might also like
Arduino Cheat Sheet
PDF
100% (1)
Arduino Cheat Sheet
1 page
Arduino - Architecture, Programming and Application
PDF
No ratings yet
Arduino - Architecture, Programming and Application
64 pages
Arduino
PDF
No ratings yet
Arduino
28 pages
Lect 2 Arduino Programming
PDF
No ratings yet
Lect 2 Arduino Programming
45 pages
Arduino Cheat Sheet
PDF
100% (1)
Arduino Cheat Sheet
1 page
MCU Solution
PDF
No ratings yet
MCU Solution
73 pages
All Simplified Arduino IOT Codes
PDF
No ratings yet
All Simplified Arduino IOT Codes
12 pages
מבוא לארדואינו
PDF
No ratings yet
מבוא לארדואינו
38 pages
3 Arduino Programming - 15march2022 - Final
PDF
No ratings yet
3 Arduino Programming - 15march2022 - Final
38 pages
Lecture 4
PDF
No ratings yet
Lecture 4
16 pages
Arduino Basics
PDF
No ratings yet
Arduino Basics
7 pages
Csed Lab
PDF
No ratings yet
Csed Lab
83 pages
Arduino FDP PPT PDF
PDF
No ratings yet
Arduino FDP PPT PDF
103 pages
C in Arduino
PDF
No ratings yet
C in Arduino
15 pages
ARDUINO CheatSheet
PDF
No ratings yet
ARDUINO CheatSheet
2 pages
Arduino Aide Mémoire
PDF
No ratings yet
Arduino Aide Mémoire
1 page
Cse 630 A1
PDF
No ratings yet
Cse 630 A1
27 pages
Arduino Sheet (Verso)
PDF
No ratings yet
Arduino Sheet (Verso)
1 page
Final Arm Cheat Sheet
PDF
No ratings yet
Final Arm Cheat Sheet
1 page
Arduino Cheat Sheet
PDF
100% (9)
Arduino Cheat Sheet
1 page
3A Programming Cheat Sheet V2
PDF
No ratings yet
3A Programming Cheat Sheet V2
2 pages
Arduino QRC v2 - 1
PDF
No ratings yet
Arduino QRC v2 - 1
2 pages
Ard Comenzi 2
PDF
No ratings yet
Ard Comenzi 2
6 pages
Functions: For Controlling The Arduino Board and Performing Computations
PDF
No ratings yet
Functions: For Controlling The Arduino Board and Performing Computations
5 pages
ROBOTICS PRACTICAL FILE AURDINO 7 Tinkercad
PDF
No ratings yet
ROBOTICS PRACTICAL FILE AURDINO 7 Tinkercad
18 pages
Arduino Cheat Sheet
PDF
No ratings yet
Arduino Cheat Sheet
1 page
Arduino Basico
PDF
No ratings yet
Arduino Basico
28 pages
Arduino Projects
PDF
No ratings yet
Arduino Projects
13 pages
Arduino Cheat Sheet - Mark Liffiton 2024-02-14
PDF
No ratings yet
Arduino Cheat Sheet - Mark Liffiton 2024-02-14
1 page
Arduino Cheatsheet
PDF
No ratings yet
Arduino Cheatsheet
1 page
Mispack Tiles Outcast Revenant
PDF
No ratings yet
Mispack Tiles Outcast Revenant
4 pages
Arduino-PicBasicPro Code Translation
PDF
No ratings yet
Arduino-PicBasicPro Code Translation
5 pages
Chapter 1 Challenges: The Arduino Module
PDF
No ratings yet
Chapter 1 Challenges: The Arduino Module
7 pages
Libraries Structure & Flow Operators Built-In Functions: Programming Cheat Sheet
PDF
No ratings yet
Libraries Structure & Flow Operators Built-In Functions: Programming Cheat Sheet
1 page
Arduino Cheat Sheet: Structure Digital I/O Data Types
PDF
No ratings yet
Arduino Cheat Sheet: Structure Digital I/O Data Types
1 page
Functii Basic Arduino
PDF
No ratings yet
Functii Basic Arduino
5 pages
Libraries Structure & Flow Operators Built-In Functions: Programming Cheat Sheet
PDF
No ratings yet
Libraries Structure & Flow Operators Built-In Functions: Programming Cheat Sheet
1 page
Energia Cheat Sheet V.01c: Reference
PDF
No ratings yet
Energia Cheat Sheet V.01c: Reference
1 page
Introduction To Arduino
PDF
No ratings yet
Introduction To Arduino
22 pages
Introduction To Arduino Uno
PDF
No ratings yet
Introduction To Arduino Uno
6 pages
Libraries Structure & Flow Operators Built-In Functions: Programming Cheat Sheet
PDF
No ratings yet
Libraries Structure & Flow Operators Built-In Functions: Programming Cheat Sheet
1 page
Arduino Cheat Sheet VJ FM 01
PDF
100% (1)
Arduino Cheat Sheet VJ FM 01
1 page
Chapter1 2challenges
PDF
No ratings yet
Chapter1 2challenges
10 pages
Chapter 1 Challenges: Questions
PDF
No ratings yet
Chapter 1 Challenges: Questions
6 pages
Chapter1 2challenges
PDF
No ratings yet
Chapter1 2challenges
5 pages
Arduino Cheat Sheet v03c
PDF
No ratings yet
Arduino Cheat Sheet v03c
1 page
Arduino Cheat Sheet
PDF
No ratings yet
Arduino Cheat Sheet
1 page