SCR Firing Control

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
afm76
Date:
Wed Nov 11 12:16:45 2020 +0000
Parent:
0:0faa3d26e55e
Commit message:
SCR firing control

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Sep 16 13:06:09 2020 +0000
+++ b/main.cpp	Wed Nov 11 12:16:45 2020 +0000
@@ -5,45 +5,27 @@
 DigitalOut scr   (D8);
 Serial pc(USBTX,USBRX);
 
-
-int temp = 0;
-float analog ;
-int angle = 0;
-
+int x,temp = 0;
 
 void interrupt ()
 {
-    for (int i = 0; i<temp; i++) {
-
-
+        wait_us(temp);                              //Delay para o disparo (angulo)
         scr = 1;
-        wait_us(temp);
+        wait(0.0015);                                   //Largura do pulso de disparo (15ms)
         scr = 0;
-        //wait(1);
-
-
-    }
-
 }
 
-
-
 int main()
 {
-
     Pulso.rise(&interrupt);
+    Pulso.fall(&interrupt);
 
     while(1) {
-
-        analog = pot;
-
+        x=pot.read()*255;                               //Converte uma leitura do ADC em float para formato int e armazena na variável x.
+        temp = x*26;
 
-        temp = (analog*45); // angulo
-        pc.printf("\n\r%1.3f ",analog);
-        wait(0.5);
-        temp =0;
-
-
+        pc.printf("\rValor Pot=\t%d \t%2.3fV\t%d us    \t ",x,pot.read(),temp);
+        
+        wait(0.01);
     }
-
 }