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?

Program structure

The structure of the ".pde" codes is divided into 2 basic functions: setup() and loop(). The setup() is the first part of the code, which is only run once when the code is initialized (or Waspmote is reset). In this part it is recommendable to include the initialization of the modules which are going to be used, as well as the part of the code which is only important when Waspmote is started.

On the other hand, the loop() function runs continuously, forming an infinite loop. The goal of this function is to measure, send the information and save energy by entering a low consumption state.

The program skeleton:

// 1. Include Libraries
// 2. Definitions
// 3. Global variables declaration

void setup()
{
    // 4. Modules initialization
}

void loop()
{
    // 5. Measure
    // 6. Send information
    // 7. Sleep Waspmote
}

And just take a look to our hundreds of examples. They try to show a certain order.

PreviousIntroductionNextLibraries includes

Last updated 4 years ago

Was this helpful?