Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int buttonPinW = 2; // Schalter Weiß Licht
- const int buttonPinB = 3; // Schalter Blau Licht
- const int buttonPinM = 4; // Schalter DC Motor Vliesfilter
- const int ledPinW = 11; // Weiß led Stripe
- const int ledPinB = 12; // Blaue led Stripe
- const int motorPin1 = 13; // Ausgang Motor Vliesfilter
- const int sensorPin = 5; // Evt Bewegungsmelder
- uint32_t altMillis;
- int fadeValueW = 0;
- int fadeValueB = 0;;
- void setup() {
- pinMode(ledPinW, OUTPUT);
- pinMode(ledPinB, OUTPUT);
- pinMode(buttonPinW, INPUT_PULLUP);
- pinMode(buttonPinB, INPUT_PULLUP);
- altMillis = millis();
- }
- void loop() {
- if (millis() - altMillis >= 100) {
- altMillis = millis();
- if (digitalRead(buttonPinW)) {
- if (fadeValueW < 255) {
- fadeValueW++;
- }
- } else {
- if (fadeValueW > 0) {
- fadeValueW--;
- }
- }
- analogWrite(ledPinW, fadeValueW);
- if (digitalRead(buttonPinB)) {
- if (fadeValueB < 255) {
- fadeValueB++;
- }
- } else {
- if (fadeValueB > 0) {
- fadeValueB--;
- }
- }
- analogWrite(ledPinB, fadeValueB);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement