Amaldi / Mbed 2 deprecated Amaldi_15_Test_MotoreDC

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
pinofal
Date:
Sat Nov 24 13:03:31 2018 +0000
Parent:
9:7bc670023361
Commit message:
Test Motore DC

Changed in this revision

TestMotoreDC.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TestMotoreDC.cpp	Sat Nov 24 13:03:31 2018 +0000
@@ -0,0 +1,77 @@
+
+/* mbed specific header files. */
+#include "mbed.h"
+
+// seriale, pulsante Blu e LED verde su scheda
+Serial pc(USBTX, USBRX);
+DigitalOut Led2 (LED2);
+DigitalIn myButton(USER_BUTTON);
+
+DigitalOut OutA (PB_0);
+DigitalOut OutB (PC_1);
+
+DigitalOut myLed(PC_9);
+
+
+
+
+/********/
+/* Main */
+/********/
+int main()
+{
+    // configura velocità della comunicazione seriale su USB-VirtualCom e invia messaggio di benvenuto
+    pc.baud(921600); //921600 bps
+     
+    pc.printf("Test Motore\r\n");
+    
+    while(true)
+    {
+        // spegni LED esterno
+        myLed=0;
+        
+        //Ferma motore
+        OutA=0;
+        OutB=0;
+        pc.printf("OutA OutB = 00\r\n");
+        wait_ms(2000);
+        
+        
+        // Ruota Left
+        OutA=0;
+        OutB=1;
+        pc.printf("OutA OutB = 01\r\n");
+        wait_ms(2000);
+        
+        // spegni LED interno
+        myLed=1;
+        
+        //Ferma motore
+        OutA=0;
+        OutB=0;
+        pc.printf("OutA OutB = 00\r\n");
+        wait_ms(2000);
+        
+        //Ferma motore
+        OutA=1;
+        OutB=0;
+        pc.printf("OutA OutB = 10\r\n");
+        wait_ms(2000);
+        
+        // Ruota Right
+        OutA=1;
+        OutB=1;
+        pc.printf("OutA OutB = 11\r\n");
+        wait_ms(2000);
+        
+        OutA=1;
+        OutB=0;
+        pc.printf("OutA OutB = 10\r\n");
+        wait_ms(2000);
+        
+        
+        
+    }
+ }
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/main.cpp	Wed Nov 21 17:31:54 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-
-/* mbed specific header files. */
-#include "mbed.h"
-
-DigitalOut LedWAD (PC_2);
-DigitalOut LedWAS (PC_3);
-DigitalOut LedWPD (PC_10);
-DigitalOut LedWPS (PA_0) ;
-DigitalOut LedYAD (PC_13);
-DigitalOut LedYAS (PC_14);
-DigitalOut LedRPD (PC_12);
-DigitalOut LedRPS (PA_1) ;
-DigitalIn myButton(USER_BUTTON);
-
-int main()
-{
-    LedWAD=0;
-    LedWAS=0;
-    LedWPD=0;
-    LedWPS=0;
-    LedYAD=0;
-    LedYAS=0;
-    LedRPD=0;
-    LedRPS=0;
-    while(true)
-    {
-        if(myButton==1)
-        {
-            LedWAD = 1;
-        }
-        else
-        {
-            LedWAD = 0;
-        }
-    }
-
-
-}
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/