mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-07-05 02:01:42 +02:00
Update Measurement sketches
This commit is contained in:
@ -0,0 +1,80 @@
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
|
||||
/*
|
||||
╔══════════════════════════════════════════════════════════════════════════════╗
|
||||
║ WARNING: This example controls the RGB-LEDs directly, bypassing the ║
|
||||
║ MultiColorLight component. This is not recommended for normal use, as it ║
|
||||
║ bypasses the safety checks and color normalization. This is only intended ║
|
||||
║ for diagnostic purposes. ║
|
||||
╚══════════════════════════════════════════════════════════════════════════════╝
|
||||
*/
|
||||
|
||||
Adafruit_NeoPixel rgbLeds(3, 48);
|
||||
|
||||
void setup() { rgbLeds.begin(); }
|
||||
|
||||
void loop() {
|
||||
// Ramp up the brightness of each color channel
|
||||
// Allows for the PWM behaviour to quickly be observed on an oscilloscope
|
||||
// Red
|
||||
for (int bri = 0; bri < 0xFF; bri += 0x1) {
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(bri, 0, 0));
|
||||
rgbLeds.show();
|
||||
delay(10);
|
||||
}
|
||||
// Red
|
||||
for (int bri = 0; bri < 0xFF; bri += 0x1) {
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(0, bri, 0));
|
||||
rgbLeds.show();
|
||||
delay(10);
|
||||
}
|
||||
// Blue
|
||||
for (int bri = 0; bri < 0xFF; bri += 0x1) {
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(0, 0, bri));
|
||||
rgbLeds.show();
|
||||
delay(10);
|
||||
}
|
||||
// Combinations of the color channels
|
||||
// Yellow (Red + Green)
|
||||
for (int bri = 0; bri < 0xFF; bri += 0x1) {
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(bri, bri, 0));
|
||||
rgbLeds.show();
|
||||
delay(10);
|
||||
}
|
||||
// Purple (Red + Blue)
|
||||
for (int bri = 0; bri < 0xFF; bri += 0x1) {
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(bri, 0, bri));
|
||||
rgbLeds.show();
|
||||
delay(10);
|
||||
}
|
||||
// Cyan (Green + Blue)
|
||||
for (int bri = 0; bri < 0xFF; bri += 0x1) {
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(0, bri, bri));
|
||||
rgbLeds.show();
|
||||
delay(10);
|
||||
}
|
||||
// White (Red + Green + Blue)
|
||||
for (int bri = 0; bri < 0xFF; bri += 0x1) {
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(bri, bri, bri));
|
||||
rgbLeds.show();
|
||||
delay(10);
|
||||
}
|
||||
|
||||
// Now some constant states for comparable measurements
|
||||
// Full brightness R+G+B
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(255, 255, 255));
|
||||
rgbLeds.show();
|
||||
sleep(5);
|
||||
// Half brightness R+G+B
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(127, 127, 127));
|
||||
rgbLeds.show();
|
||||
sleep(5);
|
||||
// Minimum brightness R+G+B
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(1, 1, 1));
|
||||
rgbLeds.show();
|
||||
sleep(5);
|
||||
// Off (baseline)
|
||||
rgbLeds.setPixelColor(0, rgbLeds.Color(0, 0, 0));
|
||||
rgbLeds.show();
|
||||
sleep(5);
|
||||
}
|
Reference in New Issue
Block a user