![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test program
Dependencies: LSM9DS1_Library2 MotorV2 SRF05 Tracker2 mbed nRF24L01P
Fork of DUMP_TRUCK_SPR2017 by
DumpTruck.h@9:5a35e2a28a47, 2017-02-23 (annotated)
- Committer:
- simplyellow
- Date:
- Thu Feb 23 20:01:28 2017 +0000
- Revision:
- 9:5a35e2a28a47
- Parent:
- 5:dc4cf6cc24b3
cleaned dumptruck.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Josahty | 0:6942f0e2198c | 1 | #ifndef MBED_DUMP_TRUCK_H |
Josahty | 0:6942f0e2198c | 2 | #define MBED_DUMP_TRUCK_H |
simplyellow | 9:5a35e2a28a47 | 3 | |
Josahty | 0:6942f0e2198c | 4 | #include "mbed.h" |
simplyellow | 9:5a35e2a28a47 | 5 | #include "Tracker.h" |
simplyellow | 9:5a35e2a28a47 | 6 | #include "IMU.h" |
simplyellow | 9:5a35e2a28a47 | 7 | #include "Motor.h" |
simplyellow | 9:5a35e2a28a47 | 8 | #include "Transceiver.h" |
simplyellow | 9:5a35e2a28a47 | 9 | |
simplyellow | 9:5a35e2a28a47 | 10 | // ADD SWITCHES & ULTRASONIC SENSOR implementation |
Josahty | 0:6942f0e2198c | 11 | |
Josahty | 0:6942f0e2198c | 12 | class DumpTruck { |
Josahty | 0:6942f0e2198c | 13 | public: |
Josahty | 0:6942f0e2198c | 14 | DumpTruck(int truckId); |
simplyellow | 9:5a35e2a28a47 | 15 | |
simplyellow | 9:5a35e2a28a47 | 16 | // motor functions |
simplyellow | 9:5a35e2a28a47 | 17 | void drive(float speed, float distance);// frontMotor |
simplyellow | 9:5a35e2a28a47 | 18 | void turn(float angle); // turnMotor |
simplyellow | 9:5a35e2a28a47 | 19 | void moveBed(bool raise, float angle); // bedMotor |
simplyellow | 9:5a35e2a28a47 | 20 | void stop(); // all Motors |
simplyellow | 9:5a35e2a28a47 | 21 | |
simplyellow | 9:5a35e2a28a47 | 22 | // ultrasonic functions |
simplyellow | 9:5a35e2a28a47 | 23 | bool detect(); // returns bool for object too close |
simplyellow | 9:5a35e2a28a47 | 24 | |
simplyellow | 9:5a35e2a28a47 | 25 | |
Josahty | 0:6942f0e2198c | 26 | protected: |
simplyellow | 9:5a35e2a28a47 | 27 | Tracker *track; |
simplyellow | 9:5a35e2a28a47 | 28 | IMU *bed; |
simplyellow | 9:5a35e2a28a47 | 29 | Motor *frontMotor; |
simplyellow | 9:5a35e2a28a47 | 30 | Motor *turnMotor; |
simplyellow | 9:5a35e2a28a47 | 31 | Motor *bedMotor; |
simplyellow | 9:5a35e2a28a47 | 32 | Transceiver *nrf; |
simplyellow | 9:5a35e2a28a47 | 33 | |
simplyellow | 9:5a35e2a28a47 | 34 | // add direct control for motor, switch, and ultrasonic sensor. |
simplyellow | 9:5a35e2a28a47 | 35 | |
Josahty | 0:6942f0e2198c | 36 | int truckNumber; |
simplyellow | 9:5a35e2a28a47 | 37 | |
simplyellow | 9:5a35e2a28a47 | 38 | // motor variables |
simplyellow | 9:5a35e2a28a47 | 39 | float speed; // drive |
simplyellow | 9:5a35e2a28a47 | 40 | float distance; // drive |
simplyellow | 9:5a35e2a28a47 | 41 | float potAngle; // turn |
simplyellow | 9:5a35e2a28a47 | 42 | float bedAngle; // bed |
simplyellow | 9:5a35e2a28a47 | 43 | |
simplyellow | 9:5a35e2a28a47 | 44 | // bed-specific variables |
simplyellow | 9:5a35e2a28a47 | 45 | bool switchState; // BusIn the two limit switches |
simplyellow | 9:5a35e2a28a47 | 46 | |
simplyellow | 9:5a35e2a28a47 | 47 | // ultrasonic-specific variables |
simplyellow | 9:5a35e2a28a47 | 48 | bool tooClose; |
simplyellow | 9:5a35e2a28a47 | 49 | float proximity |
Josahty | 0:6942f0e2198c | 50 | }; |
simplyellow | 5:dc4cf6cc24b3 | 51 | #endif |