Sz_Insper / Mbed 2 deprecated IHM04A1_V2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
henriquer
Date:
Thu Oct 15 18:53:40 2020 +0000
Commit message:
Teste IHM04A1 Controle Velocidade com Potenciometro

Changed in this revision

main.cpp 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 15 18:53:40 2020 +0000
@@ -0,0 +1,32 @@
+// IHM04A1 - Controle motor DC - Potenciometro//
+
+#include "mbed.h"
+DigitalIn  bt       (USER_BUTTON);
+DigitalOut IN1B     (D5);
+DigitalOut IN2B     (D4);
+PwmOut     ENB      (D2);        //DigitalOut ENB      (D2);
+AnalogIn  pot    (A5);
+
+Serial pc(USBTX, USBRX);
+float val_pot;
+
+int main()
+
+{
+
+    pc.baud(9600);
+
+
+    while(1) {
+
+        float dutyENB = val_pot; // Função duty -Tempo de trabablho
+
+        val_pot = pot.read();
+        pc.printf("%1.2f\n\r",val_pot);
+
+        ENB.write(dutyENB);
+        IN1B = 0;
+        IN2B = 1;
+        wait_ms(500);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Oct 15 18:53:40 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file