Waspmote Programming Guide
Development website
  • Initial page
  • Introduction
  • Program structure
  • Libraries includes
  • Variable declaration
  • Code style
  • General advice
  • RTC watchdog
  • Flash memory
  • EEPROM
  • RAM
  • Power
  • Sensor Boards
  • Networking
  • Frame class
  • Interfacing with Meshlium
  • Real deployment advice
  • API changelog
  • GitHub Project
Powered by GitBook
On this page

Was this helpful?

RAM

Waspmote's microcontroller includes an 8 kB SRAM which is shared between initialized and uninitialized variables, the dynamic memory allocator, and the stack that is used for calling subroutines and storing local variables.

  • It is a good practice to delete variables which have already been used. This will avoid confusion, like "is this old or new?".

  • Also, once a vector has been used, it is good to delete all the fields in this vector, by writing 0's or voids, for example.

  • Avoid using strings so as to save memory. When printing debug messages use the Flash memory to allocate those messages:

USB.println("This is a message");    //WRONG

USB.println(F("This is a message"));    //OK
  • Avoid using dynamic memory allocation in order to prevent memory fragmentation. It is preferable to use controlled static variables.

  • It is possible to get the free memory by calling the function freeMemory:

USB.print(F("Free Memory:"));
USB.println(freeMemory());
PreviousEEPROMNextPower

Last updated 5 years ago

Was this helpful?