library for m3Dpi robot, based on the Pololu 3pi and m3pi. m3Dpi has multiple distance sensors, gyroscope, compass and accelerometer sensor to be fully aware of its environment. With the addition of xbee or nrf24n01 module it has wireless communication capabilities.
Dependencies: m3pi ADXL345_I2C HMC5583L ITG3200 PCA9547 TLC59116 VL6180x RGB-fun xbee
M3Dpi.h@6:b60a3c005d3c, 2015-12-07 (annotated)
- Committer:
- sillevl
- Date:
- Mon Dec 07 09:30:37 2015 +0000
- Revision:
- 6:b60a3c005d3c
- Parent:
- 4:b2fe3a2545bf
add method to set the color of a single led
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sillevl | 0:9f02ae958e20 | 1 | #pragma once |
sillevl | 0:9f02ae958e20 | 2 | |
sillevl | 0:9f02ae958e20 | 3 | #include "m3pi.h" |
sillevl | 0:9f02ae958e20 | 4 | |
sillevl | 0:9f02ae958e20 | 5 | #include "StatusLed.h" |
sillevl | 0:9f02ae958e20 | 6 | #include "Color.h" |
sillevl | 0:9f02ae958e20 | 7 | #include "LedRing.h" |
sillevl | 0:9f02ae958e20 | 8 | #include "hmc5583l.h" |
sillevl | 0:9f02ae958e20 | 9 | #include "ITG3200.h" |
sillevl | 0:9f02ae958e20 | 10 | #include "ADXL345_I2C.h" |
sillevl | 0:9f02ae958e20 | 11 | #include "PCA9547.h" |
sillevl | 0:9f02ae958e20 | 12 | //#include "vl6108x.h" |
sillevl | 0:9f02ae958e20 | 13 | #include "vl6180xManager.h" |
sillevl | 0:9f02ae958e20 | 14 | #include "xbee.h" |
sillevl | 4:b2fe3a2545bf | 15 | #include "datatypes.h" |
sillevl | 0:9f02ae958e20 | 16 | |
sillevl | 4:b2fe3a2545bf | 17 | class M3Dpi : public m3pi |
sillevl | 4:b2fe3a2545bf | 18 | { |
sillevl | 4:b2fe3a2545bf | 19 | |
sillevl | 4:b2fe3a2545bf | 20 | public: |
sillevl | 0:9f02ae958e20 | 21 | M3Dpi(); |
sillevl | 4:b2fe3a2545bf | 22 | |
sillevl | 0:9f02ae958e20 | 23 | void setStatus(int color); |
sillevl | 0:9f02ae958e20 | 24 | void setStatus(Color* color); |
sillevl | 4:b2fe3a2545bf | 25 | |
sillevl | 0:9f02ae958e20 | 26 | void setLeds(int* colors); |
sillevl | 6:b60a3c005d3c | 27 | void setLed(int index, int color); |
sillevl | 4:b2fe3a2545bf | 28 | m3dpi::Distance getDistance(); |
sillevl | 4:b2fe3a2545bf | 29 | m3dpi::Direction getDirection(); // compass |
sillevl | 4:b2fe3a2545bf | 30 | m3dpi::Rotation getRotation(); // gyro |
sillevl | 4:b2fe3a2545bf | 31 | m3dpi::Acceleration getAcceleration(); |
sillevl | 4:b2fe3a2545bf | 32 | time_t getTime(); |
sillevl | 4:b2fe3a2545bf | 33 | |
sillevl | 0:9f02ae958e20 | 34 | // buttonhandler (interrupt based?) |
sillevl | 4:b2fe3a2545bf | 35 | |
sillevl | 0:9f02ae958e20 | 36 | //protected: // public for hardware testing only |
sillevl | 0:9f02ae958e20 | 37 | StatusLed status; |
sillevl | 0:9f02ae958e20 | 38 | LedRing leds; |
sillevl | 4:b2fe3a2545bf | 39 | |
sillevl | 0:9f02ae958e20 | 40 | HMC5583L compass; |
sillevl | 0:9f02ae958e20 | 41 | ITG3200 gyro; |
sillevl | 0:9f02ae958e20 | 42 | ADXL345_I2C accelerometer; |
sillevl | 0:9f02ae958e20 | 43 | VL6180xManager distance; |
sillevl | 0:9f02ae958e20 | 44 | Xbee xbee; |
sillevl | 4:b2fe3a2545bf | 45 | |
sillevl | 0:9f02ae958e20 | 46 | static const PinName SDA = p28; |
sillevl | 0:9f02ae958e20 | 47 | static const PinName SCL = p27; |
sillevl | 0:9f02ae958e20 | 48 | static const PinName XBEE_TX = p13; |
sillevl | 0:9f02ae958e20 | 49 | static const PinName XBEE_RX = p14; |
sillevl | 0:9f02ae958e20 | 50 | static const PinName XBEE_RESET = p12; |
sillevl | 0:9f02ae958e20 | 51 | static const PinName STATUS_RED = p18; |
sillevl | 0:9f02ae958e20 | 52 | static const PinName STATUS_GREEN = p19; |
sillevl | 0:9f02ae958e20 | 53 | static const PinName STATUS_BLUE = p20; |
sillevl | 4:b2fe3a2545bf | 54 | |
sillevl | 0:9f02ae958e20 | 55 | static const int XBEE_BAUD = 115200; |
sillevl | 0:9f02ae958e20 | 56 | |
sillevl | 0:9f02ae958e20 | 57 | virtual int _putc(int c); |
sillevl | 0:9f02ae958e20 | 58 | virtual int _getc(); |
sillevl | 4:b2fe3a2545bf | 59 | |
sillevl | 0:9f02ae958e20 | 60 | }; |