Jack Hansdampf / MotorinoLib

Dependents:   Motorino_Lib xxx_Motorino_Lib

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Motorino.h Source File

Motorino.h

00001 #include "mbed.h"
00002 #include "platform/mbed_thread.h"
00003 
00004 #define adresse 0x80
00005 #define EXTCLK 1<<6
00006 #define SLEEP 1<<4
00007 #define AI 1<<5
00008 #define PRE_SCALE 0xFE
00009 
00010 #define MODE1 0x0
00011 #define MODE2 0x1
00012 #define LED0_ON_L 0x06
00013 
00014 #define SDA D14
00015 #define SCL D15
00016 
00017 class Motorino
00018 {
00019     I2C *motorino;
00020     static Motorino *meinMotorino;
00021     
00022     private:
00023         Motorino(PinName sda, PinName scl);
00024         char getLED_ON_L(int nr);
00025         char getLED_ON_H(int nr);
00026         char getLED_OFF_L(int nr);
00027         char getLED_OFF_H(int nr);
00028         volatile bool busy=false;
00029 
00030     public:
00031         static Motorino* gibMotorino();
00032         void WriteToASpecificRegister(char RegAdr,char Wert);
00033         void setDutyCycle(float dtc, int lednr);
00034         void init();
00035         void servo(float pos,int nr,float start=5, float end=10);  //pos 0..180°
00036 
00037 };