Skip to content

Commit 8dcebce

Browse files
author
m19936
committed
Updated sandbox to use sensors
1 parent 66f7b7b commit 8dcebce

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/examples/sandbox/sandbox.ino

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <lte.h>
1515
#include <mcp9808.h>
1616
#include <mqtt_client.h>
17+
#include <veml3328.h>
1718

1819
#include <Wire.h>
1920

@@ -230,10 +231,18 @@ void setup() {
230231
Log.infof("Starting sandbox / landing page procedure. Version = %s\r\n",
231232
SANDBOX_VERSION);
232233

233-
if (Mcp9808.begin(0x18)) {
234+
if (Mcp9808.begin()) {
234235
Log.error("Could not initialize the temperature sensor");
235236
}
236237

238+
if (Veml3328.begin()) {
239+
Log.error("Could not initialize the light sensor");
240+
}
241+
242+
if (Veml3328.wake()) {
243+
Log.error("Could not wake up the light sensor");
244+
}
245+
237246
ECC608.begin();
238247

239248
// Find the thing ID and set the publish and subscription topics
@@ -434,10 +443,12 @@ void loop() {
434443
sprintf(transmit_buffer,
435444
"{\"type\": \"data\",\
436445
\"data\": { \
437-
\"Temperature\": %d \
446+
\"Temperature\": %d, \
447+
\"Red Light\": %d \
438448
} \
439449
}",
440-
int(Mcp9808.readTempC()));
450+
int(Mcp9808.readTempC()),
451+
Veml3328.getRed());
441452

442453
if (!MqttClient.publish(mqtt_pub_topic, transmit_buffer)) {
443454
Log.errorf("Could not publish message: %s\r\n",

0 commit comments

Comments
 (0)