4. Turning Stuff on and off

How to directly access sensor data

4.1. Turn functionality on/off

If you need to turn stuff on and off, do the following:

#include "Air.h"

Air air;

// runs once
void setup()
{
  //Turns on/off readings of sensors
  air.readings.active   = true;

  //Turns on/off updating of server
  air.api.active            = true;

  //Turns on/off local webserver
  air.webserver.active   = true;

  air.setup();
}

// runs over and over again
void loop()
{
  air.loop();
}

These switches are bool values meaning that true (on) or false (off) are only options.

e.g.

air.readings.active = true;
air.readings.active = false;

readings.active

Turns on/off readings of sensors

api.active

Turns on/off updating of server

webserver.active

Turns on/off local webserver


What’s Next