2. Debug Options

How to turn on pre-build-in serial print debugging

2.1. Debugging using serial port

Debugging using serial port is turned off by default. However, you can enable any of the following options simply by setting it to true inside of setup() { ... } call

#include "Air.h"

Air air;

// runs once
void setup()
{
  air.debug.errors     = true;
  air.debug.readings   = true;
  air.debug.led        = true;
  //air.debug.wifi       = true;
	//air.debug.api        = true;
  air.debug.json       = true;
  //air.debug.webserver  = true;
  
  air.setup();
}

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

📘

Air() { };

To change default values you can also enable it inside of lib constructor.

Specific options and what do they do:

debug.errors

Print errors (recommended always in development)

debug.wifi

Wifi connection info - useful for debugging internet connection

debug.memory

useful for memory leaks check

debug.readings

Info about sensor reading

debug.led

Info on calculating light colors and control of the light

debug.api

API processing info

debug.json

Outputs json that is being sent to the server

debug.webserver

Local web server info including client connection info

📘

Local Web Server

You also have build-in server that is available on the device. To find out your device URL/IP address, enable web server to debug inside of setup()

...
IP Address: 10.0.1.3
Subnet Mask: 255.255.255.0
Gateway: 10.0.1.1
Connected to SSID: enthusio
Wifi signal strength (RSSI):-73 dBm
My Server: http://10.0.1.3:80
...

in this case, you can access your CityOS Air device on http://10.0.1.3

#include "Air.h"

Air air;

// runs once
void setup()
{
  air.debug.errors    = true;
  air.debug.webserver = true;
  
  air.setup();
}

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

What’s Next