Mouse code for the MacroRat
Revision 1:8a4b2f573923, committed 2017-04-26
- Comitter:
- sahilmgandhi
- Date:
- Wed Apr 26 01:43:35 2017 +0000
- Parent:
- 0:a03c771ab78e
- Child:
- 2:771db996cee0
- Commit message:
- Some working code;
Changed in this revision
ITG3200.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ITG3200.lib Wed Apr 26 01:43:35 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/aberk/code/ITG3200/#b098d99dd81e
--- a/main.cpp Tue Apr 25 23:30:40 2017 +0000 +++ b/main.cpp Wed Apr 26 01:43:35 2017 +0000 @@ -1,29 +1,46 @@ #include "mbed.h" #include <stdlib.h> - +#include "ITG3200.h" DigitalOut redLed(PC_0); DigitalOut blueLed(PC_1); DigitalOut greenLed(PC_2); -DigitalOut IR_1(PB_0); +DigitalOut IR_1(PB_13); DigitalOut IR_2(PB_1); -DigitalOut IR_3(PB_13); +DigitalOut IR_3(PB_0); DigitalOut IR_4(PB_14); -Serial serial(SERIAL_TX, SERIAL_RX); +AnalogIn Rec_1(PC_5); +AnalogIn Rec_2(PC_4); +AnalogIn Rec_3(PA_6); +AnalogIn Rec_4(PA_7); + +Serial serial(PC_6, PC_7); + +ITG3200 gyro(PC_9, PA_8); int main() { - while (1) { - redLed.write(0); - wait_ms(1000); - redLed.write(1); - greenLed.write(0); - wait_ms(1000); - greenLed.write(1); - blueLed.write(0); - wait_ms(1000); - blueLed.write(1); - } + gyro.setLpBandwidth(LPFBW_42HZ); + + wait (0.1); + serial.printf("%i, %i, %i\n", gyro.getGyroX(), gyro.getGyroY(), gyro.getGyroZ()); + + IR_1.write(1); + IR_2.write(1); + IR_3.write(1); + IR_4.write(1); + + //while (1) { +// redLed.write(0); +// wait_ms(1000); +// redLed.write(1); +// greenLed.write(0); +// wait_ms(1000); +// greenLed.write(1); +// blueLed.write(0); +// wait_ms(1000); +// blueLed.write(1); +// } }