Advertisement
iSach

Untitled

Jul 28th, 2015
334
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. for (int i = 2; i < 6; i++) {
  6. pinMode(i, OUTPUT);
  7. }
  8.  
  9. Serial.begin(115200);
  10. }
  11.  
  12. void loop() {
  13.  
  14. joystick = analogRead(A0);
  15. Serial.println(joystick);
  16.  
  17. led = map(joystick, 0,1023, 2,5);
  18.  
  19. digitalWrite(led,1);
  20. delay(10);
  21. digitalWrite(led,0);
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement