coucou

Dependencies:   RoboClaw mbed

Fork of Robot2016_2-0 by ARES

Committer:
IceTeam
Date:
Thu May 05 08:46:03 2016 +0000
Revision:
76:cd8c7da76768
Parent:
71:5590dbe8393a
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jagang 58:02dc8328975a 1 #ifndef MBED_STEPPER_H
Jagang 58:02dc8328975a 2 #define MBED_STEPPER_H
Jagang 58:02dc8328975a 3
Jagang 58:02dc8328975a 4 #include "mbed.h"
Jagang 58:02dc8328975a 5
Jagang 58:02dc8328975a 6 class Stepper
Jagang 58:02dc8328975a 7 {
Jagang 58:02dc8328975a 8 public:
Jagang 58:02dc8328975a 9 Stepper(PinName _en, PinName _stepPin, PinName dir, PinName _minEndStop, float step_per_mm);
Jagang 71:5590dbe8393a 10 bool step(int _number, int _dir, float _speed, bool _async=false);
Jagang 71:5590dbe8393a 11 bool mm(int _number, int _dir, bool _async=false);
Jagang 71:5590dbe8393a 12 bool mm(float _distance, bool _async=false);
Jagang 71:5590dbe8393a 13
Jagang 71:5590dbe8393a 14 bool done();
Jagang 71:5590dbe8393a 15
Jagang 58:02dc8328975a 16 void enable();
Jagang 58:02dc8328975a 17 void disable();
Jagang 58:02dc8328975a 18
Jagang 58:02dc8328975a 19 int getEndStop() {return minEndStop.read();}
Jagang 58:02dc8328975a 20
Jagang 71:5590dbe8393a 21 void tick();
Jagang 71:5590dbe8393a 22
Jagang 58:02dc8328975a 23 float Step_Per_MM;
Jagang 58:02dc8328975a 24 private:
Jagang 58:02dc8328975a 25 DigitalOut en;
Jagang 58:02dc8328975a 26 DigitalOut stepPin;
Jagang 58:02dc8328975a 27 DigitalOut direction;
Jagang 58:02dc8328975a 28 DigitalIn minEndStop;
Jagang 71:5590dbe8393a 29
Jagang 71:5590dbe8393a 30 int number;
Jagang 71:5590dbe8393a 31 int dir;
Jagang 71:5590dbe8393a 32 float speed;
Jagang 71:5590dbe8393a 33 bool async;
Jagang 71:5590dbe8393a 34 Ticker ticker;
Jagang 71:5590dbe8393a 35
Jagang 58:02dc8328975a 36 };
Jagang 58:02dc8328975a 37
Jagang 58:02dc8328975a 38
Jagang 58:02dc8328975a 39 #endif