Add power test cases

This commit is contained in:
2025-02-14 21:08:03 +01:00
parent 2b57f300f2
commit ef8a757772
4 changed files with 139 additions and 5 deletions

View File

@ -0,0 +1,50 @@
#include "Dezibot.h"
/*
* This serves as an example of how to use the power management system deals with huge requests
* for power on an already heavily loaded system.
*/
Dezibot dezibot;
void setup() {
dezibot.begin();
Serial.begin(115200);
// Wait for Serial to init
while (!Serial) {
;
;
}
Serial.println("Starting Power Management Test");
Serial.println("Status on end of setup:");
dezibot.power.dumpPowerStatistics();
dezibot.power.dumpConsumerStatistics();
}
void dumpInfoAndWait() {
delay(100);
dezibot.power.dumpPowerStatistics();
dezibot.power.dumpConsumerStatistics();
delay(900);
}
void loop() {
dezibot.multiColorLight.setLed(ALL, 0x00FFFFFF);
Serial.println("Turned on all RGB LEDs");
dumpInfoAndWait();
dezibot.motion.move();
Serial.println("Turned on all motors");
dumpInfoAndWait();
dezibot.infraredLight.bottom.turnOn();
Serial.println("Turned on bottom IR LEDs");
dumpInfoAndWait();
dezibot.multiColorLight.turnOffLed(ALL);
dezibot.motion.stop();
dezibot.infraredLight.bottom.turnOff();
Serial.println("Turned off all LEDs and motors");
dumpInfoAndWait();
}