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
Diff: main.cpp
- Revision:
- 0:ca93a02f0af8
- Child:
- 1:4f7125fad4f8
diff -r 000000000000 -r ca93a02f0af8 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Sep 11 16:07:28 2019 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include <iostream>
+#include <math.h>
+
+Serial bt(PTE0,PTE1);// Bluetooth
+PwmOut duty(PTA5);// pwm output
+// AnalogIn pot(PTE20); // potentiometer to adjust motor speed
+DigitalOut myled(LED2);
+
+int main() {
+ duty.period(0.00005);
+ float fakePot =0;
+ bt.baud(115200);// setting the baud rate
+ bt.printf("We runnin' boys \n\r");
+
+ while(true) {
+ duty.write(fakePot); // writes value to PwmOut
+
+// void HUD(float fakePot){
+ bt.printf("\r\n Fake value:%4.3f ", fakePot);
+
+ if(bt.readable()){
+ char keyPress = bt.getc();
+ if (keyPress == 'u'){ // Pressing the 'u' key increases by 1
+ fakePot = fakePot + .001;
+ }
+ else if(keyPress == 'd' && fakePot > 0){ // Pressing the 'D' key decreases by 1
+ fakePot = fakePot -.001;
+ // if(fakePot > 100){
+ // fakePot = 100;
+ // }
+ }
+ }
+ //}
+// ***** analog *****
+ // while(true) {
+ // float potPercent = pot.read(); // takes value from potentiometer
+ // duty.write(potPercent);
+// ***** end analog *****
+
+}// ***** end main *****
+
+
+}
\ No newline at end of file