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: MPU9150_DMP MotorControl QuaternionMath SimpleIOMacros mbed
Fork of cool_step_new by
Diff: main.cpp
- Revision:
- 12:410ebe8573ce
- Parent:
- 11:ba1a630e56c4
- Child:
- 13:75892580d4ff
diff -r ba1a630e56c4 -r 410ebe8573ce main.cpp
--- a/main.cpp Wed May 13 12:25:02 2015 +0000
+++ b/main.cpp Thu May 14 09:04:28 2015 +0000
@@ -4,27 +4,19 @@
#include "Motor.h"
-void InitTimer0(void);
//led pins
DigitalOut led1(P2_6);
DigitalOut led2(P2_7);
DigitalOut led3(P2_8);
AnalogIn hallSensor(P0_26);
-
-volatile int pulses_ = 0;
//InterruptIn hall1_(P0_5), hall2_(P0_4);
//Hallsensor hall1(P1_26, P1_27);
-//Hallsensor hall2(P0_4, P0_5);
//Motor motor1(P2_0, P2_1,&hall1);
-//Motor motor2(P2_2, P2_3, &hall2);
-MPU9150 imu(P0_28, P0_27, P2_13);
-
-
-Serial RN42(P0_10, P0_11);
+//Serial RN42(P0_10, P0_11);
Serial debug(P0_2, P0_3);
Ticker infoTicker;
@@ -33,6 +25,10 @@
Timer timer2;
+Hallsensor hall2(P0_4, P0_5);
+Motor motor2(P2_2, P2_3, &hall2);
+
+MPU9150 imu(P0_28, P0_27, P2_13);
char buffer[200];
void infoTask(void)
@@ -46,11 +42,12 @@
int main()
{
- RN42.baud(9600);
+ // RN42.baud(9600);
debug.baud(115200);
// InitTimer0();
// initialize_connection();
+
infoTicker.attach(infoTask,0.2f);
if(imu.isReady()) {
@@ -121,7 +118,7 @@
debug.printf("p: %f r: %f y: %f ",pry.x/PI*180,pry.y/PI*180,pry.z/PI*180);
debug.printf("m1: %d m2: %d \r\n ",motor2.getPulses(),motor2.getPulses());
//motor1.setVelocity(pry.x/90);
- motor2.setVelocity(pry.x/90);
+ motor2.setVelocity(0.7);
}
}
