From 51380ac692b43708d05a1244a068f5beb302731f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phillip=20K=C3=BChne?= Date: Thu, 13 Feb 2025 21:29:53 +0100 Subject: [PATCH] Update Power Management Test --- .../Power_Management_Test.ino | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 example/advanced/Power_Management_Test/Power_Management_Test.ino diff --git a/example/advanced/Power_Management_Test/Power_Management_Test.ino b/example/advanced/Power_Management_Test/Power_Management_Test.ino new file mode 100644 index 0000000..16cd0a7 --- /dev/null +++ b/example/advanced/Power_Management_Test/Power_Management_Test.ino @@ -0,0 +1,55 @@ +#include "Dezibot.h" +#define HEADER_SERIAL +#define HEADER_SERIAL_RX_PIN 16 +#define HEADER_SERIAL_TX_PIN 17 + +Dezibot dezibot; + +void setup() { + // Initialize all modules separately so header stays unused + dezibot.multiColorLight.begin(); + dezibot.motion.begin(); + dezibot.infraredLight.begin(); + + #ifdef HEADER_SERIAL + Serial1.begin(115200, SERIAL_8N1, HEADER_SERIAL_RX_PIN, HEADER_SERIAL_TX_PIN); + #else + Serial1.begin(115200); + #endif + // Wait for Serial to init + while (!Serial) { + ; + ; + } + Serial1.println("Starting Power Management Test"); + Serial1.println("Status on end of setup:"); + #ifdef Power_h + dezibot.power.dumpPowerStatistics(); + dezibot.power.dumpConsumerStatistics(); + #endif +} + +void dumpInfoAndWait() { + delay(100); + dezibot.power.dumpPowerStatistics(); + dezibot.power.dumpConsumerStatistics(); + delay(900); +} + +void loop() { + dezibot.multiColorLight.setLed(ALL, 0x00FFFFFF); + Serial1.println("Turned on all RGB LEDs"); + #ifdef Power_h + dumpInfoAndWait(); + #endif + dezibot.motion.move(); + Serial1.println("Turned on all motors"); + #ifdef Power_h + dumpInfoAndWait(); + #endif + dezibot.infraredLight.bottom.turnOn(); + Serial1.println("Turned on bottom IR LEDs"); + #ifdef Power_h + dumpInfoAndWait(); + #endif +} \ No newline at end of file