2

Dependencies:   mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
Sumobot
Date:
Mon Nov 27 01:28:37 2017 +0000
Commit message:
ujbhknlm,; ;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r af38ab8b4a29 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 27 01:28:37 2017 +0000
@@ -0,0 +1,48 @@
+#include "mbed.h"
+#include "rtos.h"
+
+DigitalIn opto(p23);            //Se declara el pin donde entran los pulsos del optoacoplador 1 "en sucio"
+DigitalOut senal1(p21);         //Se declara el pin de salida que da los pulsos al optoacoplador 2
+Thread Thread2;
+AnalogIn pot(p19);
+          
+float b, c, d=.9, Control1=0;                     //Variable flotante en la cual se guardará la velocidad en rpm
+int iteraciones=0;              //iteraciones=Variable que contará el número de pulsos
+
+void contador() {              //Función ejecutada por la interrupción inter, la cual es un contador para la variable iteración
+    d=.9;
+    Thread::wait(2000);
+    d=.8;
+    Thread::wait(2000);
+    d=.7;
+    Thread::wait(2000);
+    d=.6;
+    Thread::wait(2000);
+    d=.5;
+    while(1)
+    {
+    d= pot.read();
+    }
+    
+}
+
+int main() { 
+
+    Thread2.start(contador);     
+    
+    while(1) {
+    
+    senal1=0;
+    c = d*0.00833;
+    
+        if (opto==1)
+        {
+        wait(c); 
+        senal1=1;
+        wait(.0003);
+        senal1=0;
+        wait(.009-c);    
+        }
+     
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r af38ab8b4a29 mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Mon Nov 27 01:28:37 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#5713cbbdb706
diff -r 000000000000 -r af38ab8b4a29 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Nov 27 01:28:37 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600
\ No newline at end of file