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: CURRENT_CONTROL IIR LSM9DS0 MEDIAN_FILTER PID QEI RF24 SENSOR_FUSION mbed
Revision 1:ddc39900f9b8, committed 2016-04-21
- Comitter:
- adam_z
- Date:
- Thu Apr 21 08:50:02 2016 +0000
- Parent:
- 0:150bb4605023
- Child:
- 2:53a942d1b1e5
- Commit message:
- Pwm output ok;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 21 07:51:53 2016 +0000
+++ b/main.cpp Thu Apr 21 08:50:02 2016 +0000
@@ -11,6 +11,11 @@
Ticker WIPVTimer;
void WIPVTimerInterrupt();
+PwmOut M1C1(D7);
+PwmOut M1C2(D11);
+PwmOut M2C1(D8);
+PwmOut M2C2(A3);
+
DigitalOut led1(LED1);
int main()
@@ -27,6 +32,14 @@
sensor.setGyroOffset(38,-24,-106);
sensor.setAccelOffset(-793,-511,300);
+ M1C1.period_us(50);
+ M1C1.write(0.7);
+ M2C1.period_us(50);
+ M2C1.write(0.7);
+ TIM1->CCER |= 4; //enable ch1 complimentary output
+ TIM1->CCER |= 64;//enable ch1 complimentary output
+
+
WIPVTimer.attach_us(WIPVTimerInterrupt, 1000.0);
while(true) {}
}
@@ -55,14 +68,12 @@
float data_array[6];
-
data_array[0] = sensor.readFloatAccelX();
data_array[1] = sensor.readFloatAccelY();
data_array[2] = sensor.readFloatAccelZ();
data_array[3] = sensor.readFloatGyroX();
data_array[4] = sensor.readFloatGyroY();
data_array[5] = sensor.readFloatGyroZ();
-
sensor.complementaryFilter(data_array, Ts);
pc.printf("%5.4f, ", sensor.pitch);

