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
Revision 16:2101784637fc, committed 2018-04-24
- Comitter:
- KDrainEE
- Date:
- Tue Apr 24 01:47:06 2018 +0000
- Parent:
- 15:d820f7c1898e
- Commit message:
- It counts and displays; States work pretty well, offtrack works the first time...; Still controllable from terminal; Needs a lot of tuning; Bumpers work; Buttons work; TODO: ; 1. Clean up states; 2. Tuning; 3. Don't cry; 4. Cry a lot;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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');