test

Fork of motor by H29Ateam

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers motor.h Source File

motor.h

00001 #pragma once
00002 #include "mbed.h"
00003 
00004 class motor
00005 {
00006 private:
00007     uint8_t number;
00008     I2C *i2c;
00009     long map(long x, long in_min, long in_max, long out_min, long out_max);
00010     int H_B;
00011     bool inited;
00012 public:
00013     motor() {
00014         H_B = 0;
00015         number = 0x00;
00016         inited = false;
00017         speed = 0;
00018         direction = 1;
00019         cwMax = 255;
00020         ccwMax = 255;
00021         cwMin = 0;
00022         ccwMin = 0;
00023     }
00024     int write(int spd);
00025     uint8_t make(int spd);
00026     uint8_t init(uint8_t t, I2C *i);
00027     void brake(bool b) {
00028         H_B = b;
00029     }
00030     uint8_t address() {
00031         return number;
00032     }
00033     uint8_t cwMax, ccwMax, cwMin, ccwMin;
00034     uint8_t speed;
00035     bool direction;
00036 };