Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions examples/air-quality-monitoring/sketch/air_quality_frames.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,50 @@
*/

const uint32_t good[] = {
0x904101f0,
0x5f420212,
0x41390a28,
0x10,
0x0f808209,
0x484042fa,
0x14509c82,
0x08000000,
};

const uint32_t moderate[] = {
0x904101f0,
0x51420212,
0x808209c8,
0xf,
0x0f808209,
0x4840428a,
0x13904101,
0xf0000000,
};

const uint32_t unhealthy_for_sensitive_groups[] = {
0x904101f0,
0x5f420212,
0x80820808,
0xf,
0x0f808209,
0x484042fa,
0x10104101,
0xf0000000,
};

const uint32_t unhealthy[] = {
0x904101f0,
0x4e420212,
0xc1010a28,
0x1f,
0x0f808209,
0x48404272,
0x14508083,
0xf8000000,
};

const uint32_t very_unhealthy[] = {
0x904101f0,
0x4042da12,
0x808209c8,
0xf,
0x0f808209,
0x485b4202,
0x13904101,
0xf0000000,
};

const uint32_t hazardous[] = {
0xd04101f0,
0x44428a16,
0x80540410,
0xa,
0x0f80820b,
0x68514222,
0x08202a01,
0x50000000,
};

const uint32_t unknown[] = {
0x400c0000,
0x4004002,
0x40,
0x1,
0x00003002,
0x40020020,
0x02000000,
0x80000000,
};
48 changes: 24 additions & 24 deletions examples/air-quality-monitoring/sketch/sketch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
//
// SPDX-License-Identifier: MPL-2.0

#include <Arduino_LED_Matrix.h>
#include <Arduino_RouterBridge.h>

#include "air_quality_frames.h"

// TODO: those will go into an header file.
extern "C" void matrixWrite(const uint32_t* buf);
extern "C" void matrixBegin();
Arduino_LED_Matrix matrix;

void setup() {
matrixBegin();
matrix.begin();
matrix.clear();

Bridge.begin();
Bridge.begin();
}

void loop() {
String airQuality;
bool ok = Bridge.call("get_air_quality").result(airQuality);
if (ok) {
if (airQuality == "Good") {
matrixWrite(good);
} else if (airQuality == "Moderate") {
matrixWrite(moderate);
} else if (airQuality == "Unhealthy for Sensitive Groups") {
matrixWrite(unhealthy_for_sensitive_groups);
} else if (airQuality == "Unhealthy") {
matrixWrite(unhealthy);
} else if (airQuality == "Very Unhealthy") {
matrixWrite(very_unhealthy);
} else if (airQuality == "Hazardous") {
matrixWrite(hazardous);
} else {
matrixWrite(unknown);
}
String airQuality;
bool ok = Bridge.call("get_air_quality").result(airQuality);
if (ok) {
if (airQuality == "Good") {
matrix.loadFrame(good);
} else if (airQuality == "Moderate") {
matrix.loadFrame(moderate);
} else if (airQuality == "Unhealthy for Sensitive Groups") {
matrix.loadFrame(unhealthy_for_sensitive_groups);
} else if (airQuality == "Unhealthy") {
matrix.loadFrame(unhealthy);
} else if (airQuality == "Very Unhealthy") {
matrix.loadFrame(very_unhealthy);
} else if (airQuality == "Hazardous") {
matrix.loadFrame(hazardous);
} else {
matrix.loadFrame(unknown);
}
delay(1000);
}
delay(1000);
}
Loading