Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #include <MOTOR/AFMotor.h>
- #define IDDLE 0
- #define ENCENDIDO 1
- #define APAGADO 2
- class Button
- {
- int pin;
- public:
- Button(int pin_)
- {
- pin = pin_;
- pinMode(pin, INPUT);
- }
- int getState()
- {
- return digitalRead(pin);
- }
- };
- class motor {
- }
- int state;
- void iddle()
- {
- while (1)
- {
- if (traba.cerro())
- {
- state = ENCENDIDO;
- break;
- }
- }
- }
- void apagado()
- {
- traba.off();
- timer.reset();
- motor.off;
- state = IDDLE;
- //serial off
- }
- void encender()
- {
- if (time)
- {
- {
- traba.on();
- motor.off()
- }
- else {state = APAGADO;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement