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: FastPWM HIDScope MODSERIAL QEI Matrix biquadFilter controller errorFetch mbed motorConfig refGen MatrixMath inverseKinematics
Fork of Minor_test_serial by
Revision 7:1bffab95fc5f, committed 2017-09-19
- Comitter:
- tvlogman
- Date:
- Tue Sep 19 14:17:30 2017 +0000
- Parent:
- 6:5f433011819f
- Parent:
- 5:d396168a1b20
- Child:
- 8:0067469c3389
- Commit message:
- Working potmeter controlled LED;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp.orig | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Sep 13 12:06:37 2017 +0000
+++ b/main.cpp Tue Sep 19 14:17:30 2017 +0000
@@ -1,25 +1,31 @@
#include "mbed.h"
#include "MODSERIAL.h"
-DigitalOut ledG(LED_GREEN);
-DigitalOut ledR(LED_RED);
-DigitalOut ledB(LED_BLUE);
+PwmOut ledPwm(D5);
+float pwmPeriod = 1.0/5000.0;
+
+AnalogIn pot(A5);
+DigitalIn button(D3);
+
MODSERIAL pc(USBTX, USBRX);
+
int main()
{
- //int i = 0;
+
pc.baud(115200);
pc.printf("Hello World!\r\n");
- pc.printf("Bananas");
- ledR = true;
- ledB = true;
+ ledPwm.period(pwmPeriod);
+
while (true) {
- int keyPress = pc.getc();
- pc.putc(keyPress);
- ledG = !ledG; // toggle a led
+ float potMeterValue = pot.read();
+ ledPwm = potMeterValue;
+ wait(0.1f);
+
+
}
+
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp.orig Tue Sep 19 14:17:30 2017 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+#include "MODSERIAL.h"
+
+DigitalOut ledG(LED_GREEN);
+DigitalOut ledR(LED_RED);
+DigitalOut ledB(LED_BLUE);
+MODSERIAL pc(USBTX, USBRX);
+
+int main()
+{
+ //int i = 0;
+ pc.baud(115200);
+ pc.printf("Hello World!\r\n");
+ pc.printf("Bananas");
+
+ ledR = true;
+ ledB = true;
+
+ while (true) {
+ int keyPress = pc.getc();
+ pc.putc(keyPress);
+ ledG = !ledG; // toggle a led
+
+ }
+}
