Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HMC6352 QEI Servo mbed
Revision 1:f465d89a26b0, committed 2013-08-01
- Comitter:
- OGA
- Date:
- Thu Aug 01 09:05:23 2013 +0000
- Parent:
- 0:4644bf6bca6a
- Commit message:
- ????
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Jul 31 04:43:58 2013 +0000
+++ b/main.cpp Thu Aug 01 09:05:23 2013 +0000
@@ -8,7 +8,7 @@
//#define ROTATE_PER_REVOLUTIONS 360//enko-da no bunkainou
//QEI wheel(p23/*A*/, p24/*B*/, NC, ROTATE_PER_REVOLUTIONS, QEI::X4_ENCODING);
-//HMC6352 compass(p28/*sda*/, p27/*scl*/);
+HMC6352 compass(p28/*sda*/, p27/*scl*/);
Servo myservo1(p21);
Servo myservo2(p22);
DigitalOut myled(LED1);
@@ -73,15 +73,16 @@
timer2.start();
interrupt.attach(&tic_sensor, 0.1/*sec*/);
- //compass.setOpMode(HMC6352_CONTINUOUS, 1, 20);
+ compass.setOpMode(HMC6352_CONTINUOUS, 1, 20);
//printf("test%d\n",com_val);
while(1) {
wait(0.1);
- printf("pid:%.5d\n", ultrasonicVal[0]);
-
+ // printf("pid:%.5d\n", ultrasonicVal[0]);
+ printf("Heading is: %f\n", compass.sample() / 10.0);
+
if((ultrasonicVal[0] < 1000)&&(ultrasonicVal[1] < 1000)){
myservo1 = 0.5;
myservo2 = 0.5;