Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #include <DmxSimple.h>
- void setup()
- {
- pinMode(A0, INPUT);
- pinMode(A1, INPUT);
- pinMode(2, INPUT_PULLUP);
- Serial.begin(9600);
- DmxSimple.usePin(3);
- DmxSimple.maxChannel(2);
- }
- void loop()
- {
- int pot0 = map(analogRead(A0), 0, 1023, 16, 255);
- int pot1 = map(analogRead(A1), 0, 1023, 16, 255);
- int button = digitalRead(2);
- if (button == LOW)
- {
- DmxSimple.write(1, pot0); // freq
- DmxSimple.write(2, pot1); // brightness
- }
- else
- {
- DmxSimple.write(1, 0);
- DmxSimple.write(2, 0);
- }
- Serial.print(pot0);
- Serial.print(" - ");
- Serial.print(pot1);
- Serial.print(" - ");
- Serial.print(button);
- Serial.println();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement