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-20
- Revision:
- 8:fd8a30a6923d
- Child:
- 9:6ae4359b73df
File content as of revision 8:fd8a30a6923d:
#include "mbed.h" #include "m3pi_ng.h" m3pi thinggy; int main() { float speed = 0.1; float threshold = 0.01; wait(2.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(); // Line is more than the threshold to the right, slow the left motor if (position > threshold) { thinggy.right(speed); } // Line is more than 50% to the left, slow the right motor else if (position < -threshold) { thinggy.left(speed); } // Line is in the middle else { thinggy.forward(speed); } } }