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:
- 16:2101784637fc
- Parent:
- 15:d820f7c1898e
diff -r d820f7c1898e -r 2101784637fc main.cpp
--- a/main.cpp Tue Apr 24 01:31:48 2018 +0000
+++ b/main.cpp Tue Apr 24 01:47:06 2018 +0000
@@ -60,6 +60,7 @@
Ticker control;
Timer ctrlTimer;
+Timer checkpointTimer;
bool lTrig = false;
bool rTrig = false;
@@ -239,21 +240,30 @@
if(Setpoint < MINM) Setpoint = MINM;
}
+void incrimentCheckpoint()
+{
+ if (checkpointTimer > 0.1)
+ {
+ checkpoint++;
+ checkpointTimer.reset();
+ }
+ displayCheckpoint();
+
+}
void incL()
{
leftCount++;
- checkpoint++;
lTrig = true;
- displayCheckpoint();
+ incrimentCheckpoint();
+
}
void incR()
{
rightCount++;
- checkpoint++;
rTrig = true;
- displayCheckpoint();
+ incrimentCheckpoint();
}
void steer()
@@ -314,6 +324,7 @@
servoSig.period(STEER_FREQ);
gateDrive.period(.00005f);
gateDrive.write(Setpoint);
+ checkpointTimer.start();
ctrlTimer.start();
@@ -330,6 +341,7 @@
stopButton.fall(&stopState);
waitState();
while(1) {
+ if (checkpoint > 10) checkpoint = 0;
checkLED.write(checkpoint);
if(lTrig){
bt.putc('l');