servo
Dependents: followCar script_voor_project
Fork of Servo by
Servo.h@4:b9fe7af92cd5, 2016-12-02 (annotated)
- Committer:
- backman
- Date:
- Fri Dec 02 13:03:33 2016 +0000
- Revision:
- 4:b9fe7af92cd5
- Parent:
- 3:36b69a7ced07
servo final;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 2:8995c167f399 | 1 | /* mbed R/C Servo Library |
simon | 2:8995c167f399 | 2 | * Copyright (c) 2007-2010 sford, cstyles |
simon | 2:8995c167f399 | 3 | * |
simon | 2:8995c167f399 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
simon | 2:8995c167f399 | 5 | * of this software and associated documentation files (the "Software"), to deal |
simon | 2:8995c167f399 | 6 | * in the Software without restriction, including without limitation the rights |
simon | 2:8995c167f399 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
simon | 2:8995c167f399 | 8 | * copies of the Software, and to permit persons to whom the Software is |
simon | 2:8995c167f399 | 9 | * furnished to do so, subject to the following conditions: |
simon | 2:8995c167f399 | 10 | * |
simon | 2:8995c167f399 | 11 | * The above copyright notice and this permission notice shall be included in |
simon | 2:8995c167f399 | 12 | * all copies or substantial portions of the Software. |
simon | 2:8995c167f399 | 13 | * |
simon | 2:8995c167f399 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
simon | 2:8995c167f399 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
simon | 2:8995c167f399 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
simon | 2:8995c167f399 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
simon | 2:8995c167f399 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
simon | 2:8995c167f399 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
simon | 2:8995c167f399 | 20 | * THE SOFTWARE. |
simon | 0:24148c673250 | 21 | */ |
simon | 0:24148c673250 | 22 | |
simon | 0:24148c673250 | 23 | #ifndef MBED_SERVO_H |
simon | 0:24148c673250 | 24 | #define MBED_SERVO_H |
simon | 0:24148c673250 | 25 | |
simon | 0:24148c673250 | 26 | #include "mbed.h" |
simon | 0:24148c673250 | 27 | |
simon | 0:24148c673250 | 28 | class Servo { |
simon | 0:24148c673250 | 29 | |
simon | 0:24148c673250 | 30 | public: |
simon | 3:36b69a7ced07 | 31 | /** Create a servo object connected to the specified PwmOut pin |
simon | 0:24148c673250 | 32 | * |
simon | 3:36b69a7ced07 | 33 | * @param pin PwmOut pin to connect to |
simon | 0:24148c673250 | 34 | */ |
simon | 0:24148c673250 | 35 | Servo(PinName pin); |
simon | 0:24148c673250 | 36 | |
simon | 3:36b69a7ced07 | 37 | /** Set the servo position, normalised to it's full range |
simon | 0:24148c673250 | 38 | * |
simon | 3:36b69a7ced07 | 39 | * @param percent A normalised number 0.0-1.0 to represent the full range. |
simon | 0:24148c673250 | 40 | */ |
backman | 4:b9fe7af92cd5 | 41 | void angle(float ang); |
backman | 4:b9fe7af92cd5 | 42 | |
simon | 0:24148c673250 | 43 | |
simon | 0:24148c673250 | 44 | protected: |
simon | 0:24148c673250 | 45 | PwmOut _pwm; |
backman | 4:b9fe7af92cd5 | 46 | |
simon | 0:24148c673250 | 47 | }; |
simon | 0:24148c673250 | 48 | |
simon | 0:24148c673250 | 49 | #endif |