Init
This commit is contained in:
commit
c0f5383171
55
GuniorPIO.cpp
Normal file
55
GuniorPIO.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "GuniorPIO.h"
|
||||
|
||||
RGB_LED::RGB_LED(const uint8_t& pin_rot, const uint8_t& pin_gruen, const uint8_t pin_blau)
|
||||
: red(pin_rot), green(pin_gruen), blue(pin_blau)
|
||||
{
|
||||
}
|
||||
|
||||
void RGB_LED::start()
|
||||
{
|
||||
pinMode(red, OUTPUT);
|
||||
pinMode(green, OUTPUT);
|
||||
pinMode(blue, OUTPUT);
|
||||
}
|
||||
|
||||
void RGB_LED::stell_farbe_ein(const Farbe& farbe)
|
||||
{
|
||||
stell_farbe_ein(farbe.rot, farbe.gruen, farbe.blau);
|
||||
}
|
||||
|
||||
void RGB_LED::stell_farbe_ein(const uint8_t& rot, const uint8_t& gruen, const uint8_t& blau)
|
||||
{
|
||||
analogWrite(red, rot);
|
||||
analogWrite(green, gruen);
|
||||
analogWrite(blue, blau);
|
||||
}
|
||||
|
||||
void schalte_pin_an(const uint8_t& pin)
|
||||
{
|
||||
digitalWrite(pin, HIGH);
|
||||
}
|
||||
|
||||
void schalte_pin_aus(const uint8_t& pin)
|
||||
{
|
||||
digitalWrite(pin, LOW);
|
||||
}
|
||||
|
||||
void mache_pin_zu_schalter(const uint8_t& pin)
|
||||
{
|
||||
pinMode(pin, OUTPUT);
|
||||
}
|
||||
|
||||
void mache_pin_zu_sensor(const uint8_t& pin)
|
||||
{
|
||||
pinMode(pin, INPUT_PULLUP);
|
||||
}
|
||||
|
||||
void warte(const float& millisekunden)
|
||||
{
|
||||
delay((int)millisekunden);
|
||||
}
|
||||
|
||||
void regel_pin(const uint8_t& pin, const float& staerke)
|
||||
{
|
||||
analogWrite(pin, (uint8_t)(255 * staerke) % 256);
|
||||
}
|
52
GuniorPIO.h
Normal file
52
GuniorPIO.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef __GUNIOR_PIO
|
||||
#define __GUNIOR_PIO
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#define SEKUNDE * 1000.0
|
||||
#define SEKUNDEN * 1000.0
|
||||
|
||||
#define ROT {255, 0, 0}
|
||||
#define GRUEN {0, 255, 0}
|
||||
#define BLAU {0, 0, 255}
|
||||
#define GELB {255, 255, 0}
|
||||
#define ORANGE {255, 64, 0}
|
||||
#define LILA {255, 0, 255}
|
||||
#define CYAN {0, 255, 255}
|
||||
#define WEISS {255, 255, 255}
|
||||
|
||||
typedef struct {
|
||||
uint8_t rot;
|
||||
uint8_t gruen;
|
||||
uint8_t blau;
|
||||
} Farbe;
|
||||
|
||||
class RGB_LED
|
||||
{
|
||||
const uint8_t red;
|
||||
const uint8_t green;
|
||||
const uint8_t blue;
|
||||
|
||||
public:
|
||||
RGB_LED(const uint8_t& pin_rot, const uint8_t& pin_gruen, const uint8_t pin_blau);
|
||||
|
||||
void start();
|
||||
|
||||
void stell_farbe_ein(const Farbe& farbe);
|
||||
|
||||
void stell_farbe_ein(const uint8_t& rot, const uint8_t& gruen, const uint8_t& blau);
|
||||
};
|
||||
|
||||
void schalte_pin_an(const uint8_t& pin);
|
||||
|
||||
void schalte_pin_aus(const uint8_t& pin);
|
||||
|
||||
void mache_pin_zu_schalter(const uint8_t& pin);
|
||||
|
||||
void mache_pin_zu_sensor(const uint8_t& pin);
|
||||
|
||||
void warte(const float& millisekunden);
|
||||
|
||||
void regel_pin(const uint8_t& pin, const float& staerke);
|
||||
|
||||
#endif
|
9
library.properties
Normal file
9
library.properties
Normal file
@ -0,0 +1,9 @@
|
||||
name=GuniorPIO
|
||||
version=1.0.0
|
||||
author=Mal
|
||||
maintainer=Mal
|
||||
sentence=Simplifies the basic functions especially the naming
|
||||
paragraph=Defines self explanatory functions that replace the basic functions.
|
||||
category=Signal Input/Output
|
||||
url=https://git.leinelab.org/Mal/guniorpio
|
||||
architectures=*
|
Loading…
x
Reference in New Issue
Block a user