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.
commands.h
- Committer:
- NKarandey
- Date:
- 2017-03-24
- Revision:
- 49:731c95cd5852
- Child:
- 51:bab6e5eb864a
File content as of revision 49:731c95cd5852:
#include <vector>
#include "mbed.h"
#include "controlLoops.h"
Ticker lifeTicker;
volatile bool commandFinished = false;
void stopCommand() {
commandFinished = true;
lifeTicker.detach();
controlTicker.detach();
}
void rotateWith(float r, float v) {
}
void setVelocity(float v) {
// targetV = v;
// goalRevs = 900.0f;
// print("Spinning with V=%.2f\n\r", targetV);
lifeTicker.attach(&stopCommand, 10);
}
void playTune(float freq) {
motorPWMPeriod = 1.0f / freq;
// motorOut(0, 0.5);
Thread::wait(1000);
}
void playTunes(const vector<float>& tunes) {
for (int i=0; i<tunes.size(); ++i) {
playTune(tunes[i]);
}
// motorPWMPeriod = defaultMotorPWMPeriod;
stopMotor();
}
