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.
Revision 3:880f15be8c72, committed 2017-04-28
- Comitter:
- christine222
- Date:
- Fri Apr 28 01:08:29 2017 +0000
- Parent:
- 2:771db996cee0
- Child:
- 4:b5b7836ca2b0
- Commit message:
- added some gyro stuff
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 27 22:02:14 2017 +0000
+++ b/main.cpp Fri Apr 28 01:08:29 2017 +0000
@@ -2,12 +2,13 @@
#include <stdlib.h>
#include "ITG3200.h"
+
DigitalOut redLed(PC_0);
DigitalOut blueLed(PC_1);
DigitalOut greenLed(PC_2);
-DigitalOut IR_1(PB_13);
-DigitalOut IR_2(PB_1);
+DigitalOut IR_1(PB_1);
+DigitalOut IR_2(PB_13);
DigitalOut IR_3(PB_0);
DigitalOut IR_4(PB_14);
@@ -20,23 +21,37 @@
ITG3200 gyro(PC_9, PA_8);
+
+volatile double reading = 0;
+
+int gyroX = 0;
+int gyroY = 0;
+int gyroZ = 0;
+
int main()
{
+ //Set highest bandwidth.
gyro.setLpBandwidth(LPFBW_42HZ);
-
+ serial.baud(9600);
+
wait (0.1);
- serial.printf("%i, %i, %i\n", gyro.getGyroX(), gyro.getGyroY(), gyro.getGyroZ());
-
- //IR_1.write(1);
+
+// IR_1.write(1);
// IR_2.write(1);
// IR_3.write(1);
// IR_4.write(1);
-
+
redLed.write(1);
greenLed.write(0);
blueLed.write(1);
- //while (1) {
+ while (1) {
+
+ wait(0.1);
+ serial.printf("%i, %i, %i\n", gyro.getGyroX(), gyro.getGyroY(), gyro.getGyroZ());
+
+ //reading = Rec_4.read();
+// serial.printf("reading: %f\n", reading);
// redLed.write(0);
// wait_ms(1000);
// redLed.write(1);
@@ -46,5 +61,5 @@
// blueLed.write(0);
// wait_ms(1000);
// blueLed.write(1);
-// }
+ }
}