Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos mbed QEI
Actuators/Arms/Arm.h@5:56a5fdd373c9, 2013-04-04 (annotated)
- Committer:
- madcowswe
- Date:
- Thu Apr 04 14:44:14 2013 +0000
- Revision:
- 5:56a5fdd373c9
- Parent:
- 4:1be0f6c6ceae
- Child:
- 65:4709ff6c753c
Removed e stop button code, as power will be used through the button instead.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| twighk | 1:8119211eae14 | 1 | |
| twighk | 1:8119211eae14 | 2 | // Eurobot13 WhiteArm.h |
| twighk | 1:8119211eae14 | 3 | |
| twighk | 1:8119211eae14 | 4 | #include "mbed.h" |
| twighk | 1:8119211eae14 | 5 | #include "Servo.h" |
| twighk | 1:8119211eae14 | 6 | |
| madcowswe | 5:56a5fdd373c9 | 7 | class Arm : public Servo |
| twighk | 1:8119211eae14 | 8 | { |
| twighk | 1:8119211eae14 | 9 | private: |
| twighk | 1:8119211eae14 | 10 | bool updirn; |
| twighk | 1:8119211eae14 | 11 | |
| twighk | 1:8119211eae14 | 12 | public: |
| twighk | 4:1be0f6c6ceae | 13 | Arm ( PinName yellowPWM |
| twighk | 4:1be0f6c6ceae | 14 | , bool upflip = false |
| twighk | 4:1be0f6c6ceae | 15 | , float range = 0.0005, float degrees = 45.0 |
| twighk | 4:1be0f6c6ceae | 16 | ) |
| twighk | 4:1be0f6c6ceae | 17 | : Servo(yellowPWM) |
| twighk | 4:1be0f6c6ceae | 18 | { |
| twighk | 1:8119211eae14 | 19 | calibrate(range, degrees); |
| twighk | 1:8119211eae14 | 20 | updirn = upflip; |
| twighk | 1:8119211eae14 | 21 | } |
| twighk | 1:8119211eae14 | 22 | |
| twighk | 1:8119211eae14 | 23 | void operator()(float in) { |
| twighk | 1:8119211eae14 | 24 | write(in); |
| twighk | 1:8119211eae14 | 25 | } |
| twighk | 1:8119211eae14 | 26 | |
| twighk | 1:8119211eae14 | 27 | void clockwise() { // full lock clockwise |
| twighk | 1:8119211eae14 | 28 | write(updirn?1:0); |
| twighk | 1:8119211eae14 | 29 | } |
| twighk | 1:8119211eae14 | 30 | |
| twighk | 1:8119211eae14 | 31 | void anticlockwise() { // full lock anticlockwise |
| twighk | 1:8119211eae14 | 32 | write(updirn?0:1); |
| twighk | 1:8119211eae14 | 33 | } |
| twighk | 1:8119211eae14 | 34 | |
| twighk | 2:45da48fab346 | 35 | virtual void halt() { // servo applies no force |
| madcowswe | 5:56a5fdd373c9 | 36 | //DigitalOut myled(LED3); |
| madcowswe | 5:56a5fdd373c9 | 37 | //myled = 1; |
| twighk | 1:8119211eae14 | 38 | _pwm = 0; |
| twighk | 1:8119211eae14 | 39 | } |
| twighk | 1:8119211eae14 | 40 | }; |
| twighk | 1:8119211eae14 | 41 | |
| twighk | 1:8119211eae14 | 42 | |
| twighk | 1:8119211eae14 | 43 | /* |
| twighk | 1:8119211eae14 | 44 | class Servo{ |
| twighk | 1:8119211eae14 | 45 | private: |
| twighk | 1:8119211eae14 | 46 | PwmOut PWM; |
| twighk | 1:8119211eae14 | 47 | |
| twighk | 1:8119211eae14 | 48 | public: |
| twighk | 1:8119211eae14 | 49 | Servo(PinName pin1) : PWM(pin1){ |
| twighk | 1:8119211eae14 | 50 | } |
| twighk | 1:8119211eae14 | 51 | |
| twighk | 1:8119211eae14 | 52 | void operator()(float in){ |
| twighk | 1:8119211eae14 | 53 | PWM = in; |
| twighk | 1:8119211eae14 | 54 | } |
| twighk | 1:8119211eae14 | 55 | |
| twighk | 1:8119211eae14 | 56 | void clockwise() { // full lock clockwise |
| twighk | 1:8119211eae14 | 57 | PWM = .135; |
| twighk | 1:8119211eae14 | 58 | } |
| twighk | 1:8119211eae14 | 59 | |
| twighk | 1:8119211eae14 | 60 | void anticlockwise() { // full lock anticlockwise |
| twighk | 1:8119211eae14 | 61 | PWM = .025; |
| twighk | 1:8119211eae14 | 62 | } |
| twighk | 1:8119211eae14 | 63 | |
| twighk | 1:8119211eae14 | 64 | void relax() { // servo applies no force |
| twighk | 1:8119211eae14 | 65 | PWM = 0; |
| twighk | 1:8119211eae14 | 66 | } |
| twighk | 1:8119211eae14 | 67 | |
| twighk | 1:8119211eae14 | 68 | }; |
| twighk | 1:8119211eae14 | 69 | */ |