Motor

Fork of Motor by Reiko Randoja

Committer:
Reiko
Date:
Mon Jul 29 20:25:33 2013 +0000
Revision:
0:5cafacc2a607
Child:
1:c97f8bcd6c0f
Created motor library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Reiko 0:5cafacc2a607 1 #ifndef MOTOR_H
Reiko 0:5cafacc2a607 2 #define MOTOR_H
Reiko 0:5cafacc2a607 3
Reiko 0:5cafacc2a607 4 #include "mbed.h"
Reiko 0:5cafacc2a607 5
Reiko 0:5cafacc2a607 6 class Motor {
Reiko 0:5cafacc2a607 7 public:
Reiko 0:5cafacc2a607 8 Motor(PinName PWMpin, PinName dir1Pin, PinName dir2Pin);
Reiko 0:5cafacc2a607 9
Reiko 0:5cafacc2a607 10 void setSpeed(int newSpeed);
Reiko 0:5cafacc2a607 11 int getSpeed();
Reiko 0:5cafacc2a607 12
Reiko 0:5cafacc2a607 13 private:
Reiko 0:5cafacc2a607 14 void pid();
Reiko 0:5cafacc2a607 15
Reiko 0:5cafacc2a607 16 InterruptIn interruptA;
Reiko 0:5cafacc2a607 17 InterruptIn interruptB;
Reiko 0:5cafacc2a607 18
Reiko 0:5cafacc2a607 19 volatile int pulses;
Reiko 0:5cafacc2a607 20
Reiko 0:5cafacc2a607 21 int prevState;
Reiko 0:5cafacc2a607 22 int currState;
Reiko 0:5cafacc2a607 23 };
Reiko 0:5cafacc2a607 24
Reiko 0:5cafacc2a607 25 #endif