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
TestMotoreDC.cpp
00001 00002 /* mbed specific header files. */ 00003 #include "mbed.h" 00004 00005 // seriale, pulsante Blu e LED verde su scheda 00006 Serial pc(USBTX, USBRX); 00007 DigitalOut Led2 (LED2); 00008 DigitalIn myButton(USER_BUTTON); 00009 00010 DigitalOut OutA (PB_0); 00011 DigitalOut OutB (PC_1); 00012 00013 DigitalOut myLed(PC_9); 00014 00015 00016 00017 00018 /********/ 00019 /* Main */ 00020 /********/ 00021 int main() 00022 { 00023 // configura velocità della comunicazione seriale su USB-VirtualCom e invia messaggio di benvenuto 00024 pc.baud(921600); //921600 bps 00025 00026 pc.printf("Test Motore\r\n"); 00027 00028 while(true) 00029 { 00030 // spegni LED esterno 00031 myLed=0; 00032 00033 //Ferma motore 00034 OutA=0; 00035 OutB=0; 00036 pc.printf("OutA OutB = 00\r\n"); 00037 wait_ms(2000); 00038 00039 00040 // Ruota Left 00041 OutA=0; 00042 OutB=1; 00043 pc.printf("OutA OutB = 01\r\n"); 00044 wait_ms(2000); 00045 00046 // spegni LED interno 00047 myLed=1; 00048 00049 //Ferma motore 00050 OutA=0; 00051 OutB=0; 00052 pc.printf("OutA OutB = 00\r\n"); 00053 wait_ms(2000); 00054 00055 //Ferma motore 00056 OutA=1; 00057 OutB=0; 00058 pc.printf("OutA OutB = 10\r\n"); 00059 wait_ms(2000); 00060 00061 // Ruota Right 00062 OutA=1; 00063 OutB=1; 00064 pc.printf("OutA OutB = 11\r\n"); 00065 wait_ms(2000); 00066 00067 OutA=1; 00068 OutB=0; 00069 pc.printf("OutA OutB = 10\r\n"); 00070 wait_ms(2000); 00071 00072 00073 00074 } 00075 } 00076 00077 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Sat Oct 8 2022 21:34:42 by
1.7.2