mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-29 16:01:47 +02:00
chg: dev: added method Declarations for MultiColorLight
This commit is contained in:
parent
38e2cd6f2a
commit
e72595e739
@ -1,4 +1,4 @@
|
|||||||
#include <Adafruit_NeoPixel.h>
|
|
||||||
#include <Dezibot.h>
|
#include <Dezibot.h>
|
||||||
|
|
||||||
#define GPIO_LED 48
|
#define GPIO_LED 48
|
||||||
|
@ -54,7 +54,7 @@ void Dezibot::begin(void) {
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
/* Blink off (output low) */
|
/* Blink off (output low) */
|
||||||
ledStrip.setPixelColor(1, ledStrip.Color(100, 100, 100));
|
ledStrip.setPixelColor(1, ledStrip.Color(100, 0, 0));
|
||||||
ledStrip.show(); // Aktualisiere die Farbe des Pixels
|
ledStrip.show(); // Aktualisiere die Farbe des Pixels
|
||||||
vTaskDelay(1000);
|
vTaskDelay(1000);
|
||||||
/* Blink on (output high) */
|
/* Blink on (output high) */
|
||||||
|
31
src/multiColorLight/MultiColorLight.cpp
Normal file
31
src/multiColorLight/MultiColorLight.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include "MultiColorLight.h"
|
||||||
|
|
||||||
|
void MultiColorLight::begin(void){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void MultiColorLight::setLed(uint8_t index , uint32_t color){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void MultiColorLight::setLed(leds leds, uint32_t color){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void MultiColorLight::setTopLeds(uint32_t color){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void MultiColorLight::blink(uint16_t amount,uint32_t color, leds leds, uint32_t interval){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void MultiColorLight::turnOff(leds leds){
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
uint32_t MultiColorLight::color(uint8_t r, uint8_t g, uint8_t b){
|
||||||
|
return 0;
|
||||||
|
};
|
@ -1,6 +1,100 @@
|
|||||||
|
/**
|
||||||
|
* @file MultiColorLight.h
|
||||||
|
* @author Saskia Duebener, Hans Haupt
|
||||||
|
* @brief This component controls the ability to show multicolored light, using the RGB-LEDs
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2023-11-25
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2023
|
||||||
|
*
|
||||||
|
*/
|
||||||
#ifndef MultiColorLight_h
|
#ifndef MultiColorLight_h
|
||||||
#define MultiColorLight_h
|
#define MultiColorLight_h
|
||||||
class MultiColorLight{
|
#include <Adafruit_NeoPixel.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Describes combinations of leds on the Dezibot.
|
||||||
|
* With the Robot in Front of you, if you can read the Dezibotlogo, the LED left from the Logo is TOP_LEFT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
enum leds{
|
||||||
|
TOP_LEFT,
|
||||||
|
TOP_RIGHT,
|
||||||
|
BOTTOM,
|
||||||
|
TOP,
|
||||||
|
ALL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MultiColorLight{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief initialize the multicolor component
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void begin(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the specified led to the passed color
|
||||||
|
* @param index ranging from 0-2, 0: Left, 1: Right, 2: Bottom
|
||||||
|
* @param color A 32-bit unsigned integer representing the color in the format
|
||||||
|
* 0x00RRGGBB, where RR is the red component, GG is the green
|
||||||
|
* component, and BB is the blue component. Each color can range between 0 to 100
|
||||||
|
*/
|
||||||
|
void setLed(uint8_t index , uint32_t color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the specified leds to the passed color value
|
||||||
|
*
|
||||||
|
* @param leds which leds should be updated
|
||||||
|
* @param color A 32-bit unsigned integer representing the color in the format
|
||||||
|
* 0x00RRGGBB, where RR is the red component, GG is the green
|
||||||
|
* component, and BB is the blue component. Each color can range between 0 to 100
|
||||||
|
*/
|
||||||
|
void setLed(leds leds, uint32_t color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief sets the two leds on the top of the robot to the specified color
|
||||||
|
*
|
||||||
|
* @param color A 32-bit unsigned integer representing the color in the format
|
||||||
|
* 0x00RRGGBB, where RR is the red component, GG is the green
|
||||||
|
* component, and BB is the blue component. Each color can range between 0 to 100
|
||||||
|
*/
|
||||||
|
void setTopLeds(uint32_t color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Let LEDs blink, returns after all blinks were executed
|
||||||
|
*
|
||||||
|
* @param amount how often should the leds blink
|
||||||
|
* @param color A 32-bit unsigned integer representing the color in the format
|
||||||
|
* 0x00RRGGBB, where RR is the red component, GG is the green
|
||||||
|
* component, and BB is the blue component.
|
||||||
|
* Each color can range between 0 to 100
|
||||||
|
* Defaults to blue
|
||||||
|
* @param leds which LEDs should blink, default is TOP
|
||||||
|
* @param interval how many miliseconds the led is on, defaults to 1s
|
||||||
|
*/
|
||||||
|
void blink(uint16_t amount,uint32_t color = 0x00006400,leds leds=TOP, uint32_t interval=1000);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief turn off the given leds
|
||||||
|
*
|
||||||
|
* @param leds which leds should be turned off, defaults to ALL
|
||||||
|
*/
|
||||||
|
void turnOff(leds leds=ALL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief wrapper to calulate the used colorformat from a rgb-value
|
||||||
|
*
|
||||||
|
* @param r red (0-100)
|
||||||
|
* @param g green (0-100)
|
||||||
|
* @param b blue (0-100)
|
||||||
|
* @return A 32-bit unsigned integer representing the color in the format
|
||||||
|
* 0x00RRGGBB, where RR is the red component, GG is the green
|
||||||
|
* component, and BB is the blue component.
|
||||||
|
*/
|
||||||
|
uint32_t color(uint8_t r, uint8_t g, uint8_t b);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
#endif //MultiColorLight_h
|
#endif //MultiColorLight_h
|
Loading…
x
Reference in New Issue
Block a user