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: mbed
Diff: main.cpp
- Revision:
- 4:73510c7fa316
- Parent:
- 3:4230b82fde43
- Child:
- 5:d783972dce10
--- a/main.cpp Sat May 13 06:22:19 2017 +0000 +++ b/main.cpp Sat May 13 21:27:32 2017 +0000 @@ -1,15 +1,6 @@ -#include "mbed.h" #include "drivecontrol.h" #include "pin_assignment.h" -AnalogIn battery(PA_3); -Serial pc(PA_9, PA_10); - -DigitalOut testLed(PB_12); -DigitalOut testLed2(PB_13); -DigitalOut testLed3(PB_14); -DigitalOut testLed4(PB_15); - -Serial serial (PA_9, PA_10); +#include "io_modules.h" // Define states for debugging the mouse hardware // const int DRIVE = 1, TURN = 2, DEBUG = 3, STOP = 4; @@ -24,31 +15,27 @@ // Battery Consumption Indicator void setup() { pc.baud(9600); + // using the serial functions will have an impact on timing. + // serial.printf("voltage value is: %3.3f%%\r\n", battery.read()*100.0f); + // serial.printf("normalized: 0x%04X \r\n", battery.read_u16()); if (battery.read() < 0.67f){ // flash led - testLed = 1; - testLed2 = 1; - testLed3 = 1; - testLed4 = 1; + led_1 = 1; + led_2 = 1; + led_3 = 1; + led_4 = 1; } } // Performs the basic drive control of the mouse int main() { - DriveControl * driver = new DriveControl(START_POS, END_POS); + DriveControl * driver = new DriveControl (START_POS, END_POS); while(1) { setup(); - - serial.printf("voltage value is: %3.3f%%\r\n", battery.read()*100.0f); - serial.printf("normalized: 0x%04X \r\n", battery.read_u16()); - - testLed2 = 1; - testLed4 = 1; - + led_1 = 1; driver->drive_one_forward(); - wait(0.5); driver->stop(); - wait(3); + wait(10); } } \ No newline at end of file