IT GOES NORTH MOST OF THE TIME
Dependencies: HMC6352 Motor mbed
Revision 5:99545cf4dff4, committed 2012-10-04
- Comitter:
- vsavkin3
- Date:
- Thu Oct 04 22:05:37 2012 +0000
- Parent:
- 4:9011798d1a20
- Child:
- 6:2b89c05628ce
- Commit message:
- Compass interfaced with the robot. Heading can be read.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Oct 04 22:05:11 2012 +0000 +++ b/main.cpp Thu Oct 04 22:05:37 2012 +0000 @@ -7,11 +7,13 @@ AnalogIn irLeft(p20); AnalogIn irFront(p19); AnalogIn irRight(p18); +HMC6352 compass(p9, p10); enum direction{ Right, Forward }; int main() { enum direction dir=Forward; + compass.setOpMode(HMC6352_CONTINUOUS, 1, 20); printf("Front Right Left\n\r"); int i=0; @@ -49,6 +51,9 @@ readFront=irFront; readFront=21/readFront; + + printf("Heading: %f\n\r", compass.sample()/10.0); + if (i>=10)