Wiring Connections Flashcards
Arduino’s main chip
ATMEGA328
Has SRAM, flash RAM, and EEPROM
ATMEGA328
Meaning of SRAM
Static random access memory
- holds all variables created
- 2KB or 2,048 bytes
SRAM
Holds Arduino’s boot loader (500 bytes) & compiled sketch (32,256 bytes)
Flash RAM
- 32KB or 32,756 bytes
- Initial variable is first stored in this memory and when the program starts running, this stored variable will be copied to the SRAM taking space in both SRAM and flash.
Flash RAM
EEPROM
Electronically programmable read-only memory
Stores long term information
EEPROM
VOLATILE MEMORY
SRAM (Static random access memory)
NON-VOLATILE MEMORY
- Flash RAM
- EEPROM (Electronically Programmable Read-Only Memory)
- Group of variables of similar type accessed by a single variable
- Declaring the same type of variable line per line can use up the limited memories of SRAM, so by using arrays you’re not only saving space but also organizing and tidying your sketch.
Arrays
Declare an array without initializing the pins that you’re going to use.
First line
- declare an array without defining a size.
- The compiler automatically counts the elements and creates an array of the appropriate size.
Second line
- initialize and size your array.
- Finally you can declare an array of type char, you just have to add one more element than your initialization required, It is to hold the required null character. (NOT SURE IF HERE OR NEXT LINE)
Third line
- Loop statement that cycles back and forth through a block of statements until the given condition becomes false.
- Used for repetitive and continuous operations
for()
Often manipulated inside the for loops
Arrays
Index for each array element
Loop counter
allows your program to loop continuously, and infinitely, as long as a given condition inside the parenthesis is true.
while()
Must change throughout the loop or else your loop will run endlessly.
Tested variable (under while())
adding one of a series on a fixed scale variable
- Variable must be an integer or long
Increment
subtracting one of a series on a fixed scale variable.
- Variable must be an integer or long
Decrement
Increment x by one and returns the old value of x
x++
Increment x by one and returns the new value of x
++x
Decrement x by one and returns the old value of x
x- -
Decrement x by one and returns the new value of x
Syntax: - -x