mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-19 11:01:46 +02:00
Add test case for modeling functions
This commit is contained in:
parent
62d4c6bdb0
commit
ca37aa972b
@ -0,0 +1,46 @@
|
|||||||
|
#include "Dezibot.h"
|
||||||
|
|
||||||
|
Dezibot dezibot = Dezibot();
|
||||||
|
long randomDurationMs = 0;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// put your setup code here, to run once:
|
||||||
|
dezibot.begin();
|
||||||
|
Serial.begin(115200);
|
||||||
|
// init RNG
|
||||||
|
randomSeed(analogRead(GPIO_NUM_42));
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
randomDurationMs = random(0, 10e4);
|
||||||
|
uint32_t color = random(0, 0xFFFFFF);
|
||||||
|
Serial.printf("Estimated current and charge consumption of turning an RGB "
|
||||||
|
"LED on at color 0x%06X for %d ms: %f mA, %f C\n",
|
||||||
|
color, randomDurationMs,
|
||||||
|
dezibot.multiColorLight.modelCurrentConsumption(color),
|
||||||
|
dezibot.multiColorLight.modelChargeConsumption(
|
||||||
|
TOP_LEFT, color, randomDurationMs));
|
||||||
|
randomDurationMs = random(0, 10e4);
|
||||||
|
uint32_t randomDuty = random(0, 1 << LEDC_TIMER_10_BIT);
|
||||||
|
Serial.printf(
|
||||||
|
"Estimated current and charge consumption of turning front IR LED on for "
|
||||||
|
"%d ms: %f mA, %f C\n",
|
||||||
|
randomDurationMs,
|
||||||
|
dezibot.infraredLight.front.modelCurrentConsumption(randomDuty),
|
||||||
|
dezibot.infraredLight.front.modelChargeConsumptionOn(randomDurationMs));
|
||||||
|
Serial.printf(
|
||||||
|
"Estimated current and charge consumption of turning bottom IR LED on "
|
||||||
|
"for "
|
||||||
|
"%d ms: %f mA, %f C\n",
|
||||||
|
randomDurationMs,
|
||||||
|
dezibot.infraredLight.bottom.modelCurrentConsumption(randomDuty),
|
||||||
|
dezibot.infraredLight.bottom.modelChargeConsumptionOn(randomDurationMs));
|
||||||
|
randomDurationMs = random(0, 10e4);
|
||||||
|
Serial.printf(
|
||||||
|
"Estimated current and charge consumption of running motor at default "
|
||||||
|
"duty cycle for "
|
||||||
|
"%d ms: %f mA, %f C\n",
|
||||||
|
randomDurationMs, dezibot.motion.left.modelCurrentConsumption(3900),
|
||||||
|
dezibot.motion.left.modelChargeConsumption(3900, randomDurationMs));
|
||||||
|
delay(10000);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user