Library for using the xbee-compatible Bluetooth Bee Module on an m3pi.
Dependencies: SensoryTest
Fork of btbee by
main.cpp
- Committer:
- mmpeter
- Date:
- 2014-05-21
- Revision:
- 14:7ddbd9f475ad
- Parent:
- 13:4016c362b0d5
- Child:
- 15:cc5b8a858c6e
File content as of revision 14:7ddbd9f475ad:
#include "mbed.h" #include "m3pi_ng.h" m3pi thinggy; int main() { float speed = 0.25; float correction; float k = -0.3; thinggy.locate(0,1); thinggy.printf("Line Flw"); wait(1.0); thinggy.sensor_auto_calibrate(); while(1) { // -1.0 is far left, 1.0 is far right, 0.0 in the middle float position = thinggy.line_position(); correction = k*(position); //speed limiting for right motor if(speed + correction > 1){ thinggy.right_motor(1); } else{ thinggy.right_motor(speed+correction); } //speed limiting for left motor if(speed - correction > 1){ thinggy.left_motor(1); } else{ thinggy.left_motor(speed-correction); } } }