Increasing available memory

To increase available RAM Move constants to program memory instead of RAM Use the F macro to move string literals to program memory. Serial.print("some string") is stored in RAM (dynamic memory), Serial.print(F("some string literal") is stored in program memory. Any function that uses the print class functions can use the F macro (e.g.client.print). Avoid long […]

Read More

RAM

Ram used in interrupts Use volatile: volatile byte my_variable_name; Stopping constants using RAM Use the F macro to move string literals to program memory. Serial.print(“some string”) is stored in RAM (dynamic memory), Serial.print(F(“some string literal”) is stored in program memory.  Any function that uses the print class functions can use the F macro (e.g.client.print).  Use […]

Read More

Constants

Creating A  Constant const int ledPin = 13;   Storing constants in Program Memory instead of RAM You need to use the PROGMEM modifier – see here. Reading the values also requies special handling by using pgm_read_byte_near() or  pgm_read_word_near()  

Read More

Variables – C

Using C Standard Variable Types This can be essential if using a 32bit Arduino and needing a 16bit varaible or for any code which needs to be sure what size and int variable is #include <stdint.h> bool boolean char -128 to 127 byte 0 to 255 short unsigned short int unsigned int long unsigned long long […]

Read More

Variables – Arduino Standard

Arduino Standard Variable Types char -128 to 127 (8-bit) byte 0 to 255 (8-bit) int ATMega based boards (e.g. Arduino Uno) -32,768 to 32,767 (16-bit) Arduino Due and other 32bit boards -2,147,483,648 to 2,147,483,647 (32-bit) unsigned int ATMega based boards (e.g. Arduino Uno) 0 to 65,535 (16-bit) Arduino Due and other 32bit boards 0 to […]

Read More