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 MotorLab3Code
Diff: main.cpp
- Revision:
- 1:5b2bc7ec7b14
- Parent:
- 0:cb571e42343c
- Child:
- 2:060a86df835f
--- a/main.cpp Wed Jan 30 21:05:23 2019 +0000
+++ b/main.cpp Thu Jan 31 00:39:41 2019 +0000
@@ -1,22 +1,16 @@
#include "mbed.h"
#include <iostream>
-Serial pc(USBTX, USBRX);
AnalogIn AI_in(PTB0);
PwmOut PWM_out(PTE20);
-float SP;
-float DC;
+
+
int main() {
PWM_out.period(.05);
-
while(1) {
- SP=AI_in;
- DC=SP / 3.3;
- PWM_out=DC * 100;
- cout <<PWM_out.read() << endl;
-
-
+ PWM_out.write(AI_in.read());
+ wait(.05);
}
}