Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int buttonPinW = 4; // Schalter Weiß Licht
- const int buttonPinB = 7; // Schalter Blau Licht
- const int buttonPinM = 2; // Schalter DC Motor Vliesfilter
- //const int buttonPinZ = 4; // Schalter DC Motor Vliesfilter
- const int ledPinW = 3; // Weiß led Stripe
- const int ledPinB = 5; // Blaue led Stripe
- const int motorPin1 = 8; // 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(motorPin1, OUTPUT);
- //pinMode(ledPinZ, OUTPUT);
- pinMode(buttonPinW, INPUT_PULLUP);
- pinMode(buttonPinB, INPUT_PULLUP);
- pinMode(buttonPinM, INPUT_PULLUP);
- altMillis = millis();
- }
- void loop() {
- if (millis() - altMillis >= 40) {
- 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 > 5) {
- fadeValueB--;
- }
- }
- analogWrite(ledPinB, fadeValueB);
- if (digitalRead((buttonPinW)==HIGH)){
- digitalWrite(motorPin1, HIGH);
- } else {
- digitalWrite(motorPin1, LOW);}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement