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:0faa3d26e55e
- Child:
- 1:6192e5b45a58
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Sep 16 13:06:09 2020 +0000
@@ -0,0 +1,49 @@
+# include "mbed.h"
+
+AnalogIn pot(A0);
+InterruptIn Pulso(D7);
+DigitalOut scr (D8);
+Serial pc(USBTX,USBRX);
+
+
+int temp = 0;
+float analog ;
+int angle = 0;
+
+
+void interrupt ()
+{
+ for (int i = 0; i<temp; i++) {
+
+
+ scr = 1;
+ wait_us(temp);
+ scr = 0;
+ //wait(1);
+
+
+ }
+
+}
+
+
+
+int main()
+{
+
+ Pulso.rise(&interrupt);
+
+ while(1) {
+
+ analog = pot;
+
+
+ temp = (analog*45); // angulo
+ pc.printf("\n\r%1.3f ",analog);
+ wait(0.5);
+ temp =0;
+
+
+ }
+
+}