daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include <Servo.h>
  3.  
  4. Servo myservo;  
  5. int potPin = A0;
  6. int val = 0;  
  7. int ledArray[] = {2,3,4,5};
  8.  
  9. void setup()
  10. {
  11.   myservo.attach(9);
  12.  /*
  13. for(int i = 0; 1 < 4; i++){
  14.   pinMode(ledArray[i],OUTPUT); }
  15. pinMode (ledArray[0], OUTPUT);
  16. pinMode (ledArray[1], OUTPUT);
  17. pinMode (ledArray[2], OUTPUT);
  18. pinMode (ledArray[3], OUTPUT);
  19. */
  20. }
  21. void loop()
  22. {
  23.   val = analogRead(potPin);          
  24.   val = map(val, 0, 1023, 0, 179);    
  25.   myservo.write(val);                
  26.   delay(0);              
  27.  /*
  28.  if(analogRead(val) > 1) {
  29.     digitalWrite(ledArray[0], HIGH);}
  30.   if(analogRead(val) > 250) {
  31.     digitalWrite(ledArray[1], HIGH);}
  32.   if(analogRead(val) > 500) {
  33.     digitalWrite(ledArray[2], HIGH);}
  34.   if(analogRead(val) > 750) {
  35.     digitalWrite(ledArray[3], HIGH);}
  36.  */
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top