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
Revision 6:92b0e17593e0, committed 2019-08-05
- Comitter:
- francesco01
- Date:
- Mon Aug 05 09:03:43 2019 +0000
- Parent:
- 5:b777c4f0eb63
- Commit message:
- ultima versione
Changed in this revision
| BLE-MegaPiSea_Rev3_WIP.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/BLE-MegaPiSea_Rev3_WIP.cpp Fri Jul 26 07:33:36 2019 +0000
+++ b/BLE-MegaPiSea_Rev3_WIP.cpp Mon Aug 05 09:03:43 2019 +0000
@@ -21,6 +21,7 @@
DigitalOut myLed(LED2); // LED verde sulla scheda. Associato a PA_5
DigitalOut Light(PA_0);
+DigitalIn InDiag(PC_0,PullUp); // Di Default è a Vcc. Può essere collegato a GND con un ponticello su CN10 pin18-pin20
// carattere letto dalla seriale del PC
@@ -213,6 +214,7 @@
/**********/
/* MAIN */
/**********/
+
int main()
{
@@ -221,7 +223,7 @@
pc.printf("\r\n*** L476 BLE MegaPi Motor Driver ***\r\n");
//Inizializza pin di output per Rotating Blades
- /*
+ /*
OutBlades.mode(OpenDrain);
OutBlades.output();
OutBlades.write(0);
@@ -241,7 +243,7 @@
BleRst = 1;
cCommandBLE = '0';
cOldCommandBLE = '0';
-
+
// inizializza i PWM di pilotaggio dei motori Posteriore e Anteriore
@@ -258,9 +260,15 @@
//++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++ INIZIO Ciclo Principale +++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++
-
+
while(true)
{
+
+ if (InDiag == 1)
+ myLed = 1 ;
+ else
+ myLed = 0 ;
+
//Ottieni X e Y dal Joystick e trasformali in comandi per il motore Right e Left:
//Invert X
//Calcola R+L (Call it V): V =(100-ABS(X)) * (Y/100) + Y
@@ -363,7 +371,7 @@
AntOutPWB.write(float(fL/100.0)); // DutyCycle del PWM Sinistro (Anteriore)
}
} //while (true) Ciclo principale
-
+
//++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++ FINE Ciclo Principale +++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -374,7 +382,10 @@
//++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++ INIZIO Ciclo test +++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++
- /*
+
+
+
+
//++++++++++++ INIZIO Test Ricezione Comandi da BLE ++++++++++++++++++++++++++++
while(true)
{
@@ -408,7 +419,7 @@
} // while(true) Test comandi da BLE
//++++++++++++ FINE ricezione comandi BLE ++++++++++++
- */
+
//++++++++++++ INIZIO Test modalità di funzionamento Motori con PWM ++++++++++++
/*
PostOutBI1 = 0;