Advertisement
iSach

Untitled

Aug 5th, 2015
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. byte led;
  2. int joystick;
  3.  
  4. void setup() {
  5.  
  6. for (byte n = 2; n < 9; n++)
  7. pinMode(n, OUTPUT);
  8.  
  9. Serial.begin(115200);
  10.  
  11. }
  12.  
  13. void loop() {
  14.  
  15. joystick = analogRead(A0);
  16.  
  17. Serial.println(joystick);
  18.  
  19. led = map(joystick, 0, 950, 8, 2);
  20.  
  21. digitalWrite(led, 1);
  22. delay(10);
  23. digitalWrite(led, 0);
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement