servom

Dependents:   servomotore progetto8 progetto9 progetto10 ... more

Committer:
faraonemena
Date:
Thu Mar 28 15:52:51 2019 +0000
Revision:
1:de53826667ce
servom

Who changed what in which revision?

UserRevisionLine numberNew contents of line
faraonemena 1:de53826667ce 1 /*
faraonemena 1:de53826667ce 2
faraonemena 1:de53826667ce 3 Copyright (c) 2012-2014 RedBearLab
faraonemena 1:de53826667ce 4
faraonemena 1:de53826667ce 5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
faraonemena 1:de53826667ce 6 and associated documentation files (the "Software"), to deal in the Software without restriction,
faraonemena 1:de53826667ce 7 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
faraonemena 1:de53826667ce 8 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
faraonemena 1:de53826667ce 9 subject to the following conditions:
faraonemena 1:de53826667ce 10 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
faraonemena 1:de53826667ce 11
faraonemena 1:de53826667ce 12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
faraonemena 1:de53826667ce 13 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
faraonemena 1:de53826667ce 14 PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
faraonemena 1:de53826667ce 15 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
faraonemena 1:de53826667ce 16 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
faraonemena 1:de53826667ce 17
faraonemena 1:de53826667ce 18 */
faraonemena 1:de53826667ce 19
faraonemena 1:de53826667ce 20 #ifndef _SERVO_H
faraonemena 1:de53826667ce 21 #define _SERVO_H
faraonemena 1:de53826667ce 22
faraonemena 1:de53826667ce 23 #include "mbed.h"
faraonemena 1:de53826667ce 24
faraonemena 1:de53826667ce 25 class Servo
faraonemena 1:de53826667ce 26 {
faraonemena 1:de53826667ce 27 public:
faraonemena 1:de53826667ce 28 Servo(PinName pin);
faraonemena 1:de53826667ce 29 ~Servo(void);
faraonemena 1:de53826667ce 30
faraonemena 1:de53826667ce 31 void write(unsigned char degree);
faraonemena 1:de53826667ce 32
faraonemena 1:de53826667ce 33 private:
faraonemena 1:de53826667ce 34 void convert(unsigned char degree);
faraonemena 1:de53826667ce 35
faraonemena 1:de53826667ce 36 PwmOut _servo;
faraonemena 1:de53826667ce 37 unsigned int pulse;
faraonemena 1:de53826667ce 38 };
faraonemena 1:de53826667ce 39
faraonemena 1:de53826667ce 40 #endif