Advertisement
raderraderrader

UE4 Arduino Color Mixer 2

Dec 12th, 2019
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. /*
  2. DigitalReadSerial
  3.  
  4. Reads a digital input on pin 2, prints the result to the Serial Monitor
  5.  
  6. This example code is in the public domain.
  7.  
  8. http://www.arduino.cc/en/Tutorial/DigitalReadSerial
  9. */
  10.  
  11.  
  12. const int potPin01 = A0;
  13. const int potPin02 = A1;
  14. const int potPin03 = A2;
  15.  
  16. // digital pin 2 has a pushbutton attached to it. Give it a name:
  17. int pushButton = 2;
  18.  
  19. // the setup routine runs once when you press reset:
  20. void setup() {
  21. // initialize serial communication at 9600 bits per second:
  22. Serial.begin(9600);
  23. // make the pushbutton's pin an input:
  24. pinMode(pushButton, INPUT);
  25. }
  26.  
  27. // the loop routine runs over and over again forever:
  28. void loop() {
  29. // print out the state of the potentiometers
  30. Serial.print(analogRead(potPin01));
  31. Serial.print(",");
  32. Serial.print(analogRead(potPin02));
  33. Serial.print(",");
  34. Serial.print(analogRead(potPin03));
  35. Serial.print(",");
  36.  
  37. // read the input pin:
  38. int buttonState = digitalRead(pushButton);
  39.  
  40. // print out the state of the button:
  41. Serial.println(buttonState);
  42.  
  43. delay(1); // delay in between reads for stability
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement