Console Serial IO con display OLED e seriale asincrona
Dependencies: mbed BufferedSerial AserialIOFuncLib SSD1306 TerminalPlusV2
Fork of SerialIO by
Console Serial IO con display OLED e seriale asincrona
Diff: main.cpp
- Revision:
- 7:f57abb3f0d3f
- Parent:
- 6:f8865b6d592a
- Child:
- 8:3f1d8c55b3a0
--- a/main.cpp Thu May 28 14:52:30 2015 +0000 +++ b/main.cpp Sun May 31 22:00:40 2015 +0000 @@ -2,6 +2,8 @@ #include "config.h" #include "IOFuncLib.h" + + //init standard InterruptIn mybutton(USER_BUTTON); Serial pc(SERIAL_TX, SERIAL_RX); //Apertura della seriale 2 @@ -9,55 +11,17 @@ //init funzioni personal lib Flasher led(LED1); Screen sc(&pc); +genFunctions fnz; + //var int cont=0; //------------ Funzioni ------------- -void pressed() -{ - sc.pressed(); -} - - -void callback() -{ - // Note: you need to actually read from the serial to clear the RX interrupt - // ardser.printf("%d \n", cont++); -// myled2 = !myled2; -} +#include "Functions.h" -void parser(char stringa[]) -{ - bool errp=1; -//confronta la stringa ricevuta con le costanti accettate per il comando di accensione del led -//la funzione strcmp fa parte della libreria string standard del C e confronta 2 stringhe -//restituendo 0 se le stringhe sono uguali. - if ((strcmp(stringa,"on")==0) ||(strcmp(stringa,"acceso")==0) ||(strcmp(stringa,"apriti sesamo")==0)) { - // pc.printf("Led ACCESO \n\r"); - sc.writeScreen("Led ACCESO \n",2,10); - ardser.printf("\nLed ACCESO \n\r"); - led.onOff(1); //Accende il led - errp=0; - sc.commitScreen(); - } - //Confronto per i comandi di spegnimento del led - if ((strcmp(stringa,"off")==0) ||(strcmp(stringa,"spento")==0) ||(strcmp(stringa,"chiuditi sesamo")==0)) { - // pc.printf("Led SPENTO !\n\r"); - sc.writeScreen("Led SPENTO! \n",2,10); - ardser.printf("\nLed SPENTO! \n\r"); - led.onOff(0); // spegne il led - errp=0; - sc.commitScreen(); - } - if (errp==1) { - // pc.printf("Bad command\n\r"); - sc.writeScreen("Bad Command\n",2,10); - ardser.printf("\nBad command\n\r"); - sc.commitScreen(); - } -} + //-------------- fine funzioni int main()