Advertisement
Guest User

SUPERCALIFRAGILISTICOESPIALIDOSO

a guest
Apr 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. const int pot = A0;
  2. const int alm = A1;
  3. const int cho = A2;
  4. const int cip = A3;
  5.  
  6. int s1 = 0;
  7. int s2 = 0;
  8. int s3 = 0;
  9. int s4 = 0;
  10.  
  11. #include <Servo.h>
  12.  
  13. Servo potorro;
  14. Servo almeja;
  15. Servo chocho;
  16. Servo cipote;
  17. void setup() {
  18. Serial.begin(9600);
  19. potorro.attach(9);
  20. almeja.attach(10);
  21. chocho.attach(11);
  22. cipote.attach(6);
  23. }
  24.  
  25. void loop() {
  26. s4 = analogRead(alm);
  27. Serial.print("cip = ");
  28. Serial.println(s4);
  29.  
  30. if (s4<400)
  31. {
  32. cipote.write(2);
  33. }
  34. else{
  35. cipote.write(60);
  36. }
  37. //----------------------------
  38. s3 = analogRead(alm);
  39. Serial.print("cho = ");
  40. Serial.println(s3);
  41.  
  42. if (s2<400)
  43. {
  44. chocho.write(2);
  45. }
  46. else{
  47. chocho.write(60);
  48. }
  49. //-----------------------------
  50. s2 = analogRead(alm);
  51. Serial.print("alm = ");
  52. Serial.println(s2);
  53.  
  54. if (s2<400)
  55. {
  56. almeja.write(2);
  57. }
  58. else{
  59. almeja.write(60);
  60. }
  61. //-----------------------------
  62. s1 = analogRead(pot);
  63. Serial.print("pot = ");
  64. Serial.println(s1);
  65.  
  66. if (s1<400)
  67. {
  68. potorro.write(2);
  69. }
  70. else{
  71. potorro.write(60);
  72. }
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement