Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <Arduino.h>
  2. #include <MOTOR/AFMotor.h>
  3.  
  4. #define IDDLE 0
  5. #define ENCENDIDO 1
  6. #define APAGADO 2
  7.  
  8. class Button
  9. {
  10. int pin;
  11.  
  12. public:
  13. Button(int pin_)
  14. {
  15. pin = pin_;
  16. pinMode(pin, INPUT);
  17. }
  18. int getState()
  19. {
  20. return digitalRead(pin);
  21. }
  22. };
  23.  
  24. class motor {
  25.  
  26.  
  27.  
  28.  
  29. }
  30.  
  31.  
  32.  
  33. int state;
  34.  
  35. void iddle()
  36. {
  37. while (1)
  38. {
  39. if (traba.cerro())
  40. {
  41. state = ENCENDIDO;
  42. break;
  43. }
  44. }
  45. }
  46.  
  47. void apagado()
  48. {
  49. traba.off();
  50. timer.reset();
  51. motor.off;
  52. state = IDDLE;
  53. //serial off
  54. }
  55.  
  56. void encender()
  57. {
  58. if (time)
  59. {
  60. {
  61. traba.on();
  62. motor.off()
  63. }
  64. else {state = APAGADO;
  65. }
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement