Guest User

Untitled

a guest
Dec 12th, 2019
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Arduino.h>
  2. #include <DmxSimple.h>
  3.  
  4. void setup()
  5. {
  6. pinMode(A0, INPUT);
  7. pinMode(A1, INPUT);
  8. pinMode(2, INPUT_PULLUP);
  9. Serial.begin(9600);
  10. DmxSimple.usePin(3);
  11. DmxSimple.maxChannel(2);
  12. }
  13.  
  14. void loop()
  15. {
  16. int pot0 = map(analogRead(A0), 0, 1023, 16, 255);
  17. int pot1 = map(analogRead(A1), 0, 1023, 16, 255);
  18.  
  19. int button = digitalRead(2);
  20.  
  21. if (button == LOW)
  22. {
  23. DmxSimple.write(1, pot0); // freq
  24. DmxSimple.write(2, pot1); // brightness
  25. }
  26. else
  27. {
  28. DmxSimple.write(1, 0);
  29. DmxSimple.write(2, 0);
  30. }
  31.  
  32.  
  33. Serial.print(pot0);
  34. Serial.print(" - ");
  35. Serial.print(pot1);
  36. Serial.print(" - ");
  37. Serial.print(button);
  38. Serial.println();
  39. }
RAW Paste Data