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 X_NUCLEO_IDB0XA1 BLE_API
Diff: BLE_LED_IDB0XA1_Relay.cpp
- Revision:
- 8:766bd3e610fe
- Parent:
- 7:79fe72eb3771
--- a/BLE_LED_IDB0XA1_Relay.cpp Sun Jul 01 11:32:06 2018 +0000
+++ b/BLE_LED_IDB0XA1_Relay.cpp Sat Dec 08 12:30:48 2018 +0000
@@ -11,8 +11,12 @@
DigitalIn myButton(USER_BUTTON);
Serial pc(USBTX, USBRX);
+DigitalOut OutRed(PA_4);
+DigitalOut OutBlue(PA_1);
+DigitalOut OutGreen(PB_0);
-const static char DEVICE_NAME[] = "Amaldi_Ex_5";
+
+const static char DEVICE_NAME[] = "Amaldi_Exs_19";
static const uint16_t uuid16_list[] = {LEDService::LED_SERVICE_UUID};
LEDService *ledServicePtr;
@@ -45,32 +49,56 @@
{
case 0:
{
- Led1 = 0x00; // spegni LED
- myLED = 0x00; // spegni LED
+ Led1 = 0x00; // spegni LED su scheda
+ //++++++++++++++ INIZIO pilota accensione delle strip LED +++++++++++++++++++++++++
+ OutRed = 0;
+ OutGreen = 0;
+ OutBlue = 0;
+ //++++++++++++++ FINE pilota accensione delle strip LED +++++++++++++++++++++++++
+
} break;
case 1:
{
- Led1 = 0x01; // accendi LED
- myLED = 0x00; // spegni LED
- myRelay=0x00;
+ Led1 = 0x01; // accendi LED su scheda
+ //++++++++++++++ INIZIO pilota accensione delle strip LED +++++++++++++++++++++++++
+ OutRed = 1;
+ OutGreen = 0;
+ OutBlue = 0;
+ //++++++++++++++ FINE pilota accensione delle strip LED +++++++++++++++++++++++++
} break;
case 2:
{
- Led1 = 0x00; // spegni LED
- myLED = 0x01; // accendi LED
+ Led1 = 0x00; // spegni LED su scheda
+ //++++++++++++++ INIZIO pilota accensione delle strip LED +++++++++++++++++++++++++
+ OutRed = 0;
+ OutGreen = 1;
+ OutBlue = 0;
+ //++++++++++++++ FINE pilota accensione delle strip LED +++++++++++++++++++++++++
+
} break;
case 3:
{
- Led1 = 0x01; // accendi LED
- myLED = 0x01; // accendi LED
- myRelay=0x01;
+ Led1 = 0x01; // accendi LED su scheda
+ //++++++++++++++ INIZIO pilota accensione delle strip LED +++++++++++++++++++++++++
+ OutRed = 0;
+ OutGreen = 0;
+ OutBlue = 1;
+ //++++++++++++++ FINE pilota accensione delle strip LED +++++++++++++++++++++++++
+
} break;
case 4:
{
- myRelay = 0x01; // accendi Relay
+ Led1 = 0x01; // accendi LED su scheda
+ //++++++++++++++ INIZIO pilota accensione delle strip LED +++++++++++++++++++++++++
+ OutRed = 1;
+ OutGreen = 1;
+ OutBlue = 1;
+ //++++++++++++++ FINE pilota accensione delle strip LED +++++++++++++++++++++++++
+
} break;
case 5:
{
+ Led1 = 0x00; // spegni LED su scheda
myRelay = 0x00; // spegni Relay
} break;
@@ -140,15 +168,21 @@
int main(void)
{
// configura velocità della comunicazione seriale su USB-VirtualCom e invia messaggio di benvenuto
- pc.baud(921600); //921600 bps
+ pc.baud(9600); //921600 bps
// messaggio di benvenuto
- pc.printf("\r\nHallo Amaldi Students - Exercise 5 \r\n");
+ pc.printf("\r\nHallo Amaldi Students - Exercise 19 \r\n");
pc.printf("\r\n*** Bluetooth Driving for LED and Relay ***\r\n");
//imposta il funzionamento del pulsante come "PullDown": Aperto = '0'. L'altra modalità di funzinamento è PullUp
myButton.mode(PullDown);
- /* ciclo di prova
+ // inizializza variabili
+ OutRed=0;
+ OutBlue=0;
+ OutGreen=0;
+
+ //+++++++++++++ INIZIO ciclo di prova ++++++
+ /*
while(true)
{
if(myButton==0x01)
@@ -157,15 +191,23 @@
//while(myButton !=0x00);
Led1=0x01;
myRelay=0x01; // accendi relay
+ OutRed = 1;
+ OutGreen = 1;
+ OutBlue = 1;
+
}
else
{
myLED=0x00;
Led1=0x00;
myRelay=0x00; // spegni relay
+ OutRed = 0;
+ OutGreen = 0;
+ OutBlue = 0;
}
}
*/
+ //++++++ FINE Ciclo di Prove
/*************** START BLE Main ************/
BLE &ble = BLE::Instance();
ble.init(bleInitComplete);