34 lines
930 B
C++

#include "Dezibot.h"
Dezibot dezibot;
void setup() {
dezibot.lightDetection.begin();
//dezibot.motion.detection.end();
// put your setup code here, to run once:
Serial.begin(115200);
// Wait for Serial to init
while (!Serial) {
;;
}
delay(1000);
// Test if VEML6040 is working correctly
char ir_value = dezibot.lightDetection.getValue(DL_FRONT);
if (ir_value != UINT16_MAX) {
Serial.printf("IR detection seems to be working (detected value: %d). Starting measurements...\r\n", ir_value);
} else {
Serial.printf("IR detection does not seem to be working correctly (detected value: %d).\n",ir_value);
exit(0);
}
Serial.println("Killing Serial peripheral now to not influence anything. Goodbye!");
delay(1000);
Serial.flush();
Serial.end();
delay(1000);
}
void loop() {
// put your main code here, to run repeatedly:
dezibot.lightDetection.getValue(IR_FRONT);
delay(10);
}