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.
Diff: commands.h
- Revision:
- 49:731c95cd5852
- Child:
- 51:bab6e5eb864a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commands.h Fri Mar 24 16:57:35 2017 +0000
@@ -0,0 +1,39 @@
+#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();
+}
\ No newline at end of file
