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: HIDScope MODSERIAL mbed
Fork of EMG_Motor_LED by
Revision 0:9922b502cbc3, committed 2018-09-25
- Comitter:
- CasperK
- Date:
- Tue Sep 25 12:31:41 2018 +0000
- Child:
- 1:aa505856416d
- Commit message:
- First try of combination of turning motor and sending potmeter value to HIDscope
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HIDScope.lib Tue Sep 25 12:31:41 2018 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/tomlankhorst/code/HIDScope/#d23c6edecc49
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Tue Sep 25 12:31:41 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/MODSERIAL/#a3b2bc878529
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Sep 25 12:31:41 2018 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "MODSERIAL.h"
+#include "HIDScope.h"
+
+PwmOut pwmpin(D6);
+PwmOut led(D10);
+AnalogIn potmeter(A5);
+DigitalIn button(D2);
+DigitalOut directionpin(D5);
+
+HIDScope scope(2);
+Ticker ticker;
+
+volatile float x;
+volatile float y;
+volatile float x_prev;
+
+void sendData() {
+ scope.set(0,potmeter); //set the potmeter data to the first scope
+// scope.set(1,x);
+ scope.send();
+}
+
+int main() {
+ float u = -0.3f; //determineusefulvalue, -0.3f is justanexample
+// x = 1;
+
+ pwmpin.period_us(60); //60 microsecondsPWM period, 16.7 kHz
+ led.period(0.00001); //10kHz
+ ticker.attach(&sendData, 0.001f); //send data to hidscope at 1kHz
+ directionpin= u > 0.0f; //eithertrueor false
+
+ while (true) {
+ pwmpin.write(potmeter); //pwm of motor is potmeter value
+ led.write(potmeter); //led is potmeter value
+ wait(0.2f);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Sep 25 12:31:41 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file
