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 3:15b67c104a2e, committed 2020-02-03
- Comitter:
- pinofal
- Date:
- Mon Feb 03 10:51:25 2020 +0000
- Parent:
- 2:eeab69a684ad
- Commit message:
- Generazione Audio Digitale
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TesysRail_1.cpp Mon Feb 03 10:51:25 2020 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" + +//Pin di uscita del segnale Audio +//AnalogOut aAudioOut(A5); +DigitalOut dAudioOut (D13); // scopi diagnostici + +// periferiche presenti On Board +DigitalOut OnBoardRedLED (LED3); +DigitalOut OnBoardGreenLED (LED1); +DigitalOut OnBoardBlueLED (LED2); +DigitalIn OnBoardButton (USER_BUTTON); + +/********************/ +/* Ciclo Principale */ +/********************/ +int main() +{ + while(true) + { + //++++++++++++++++++ INIZIO Test generazione Audio con segnale digitale +++++++++++++++++++++ + dAudioOut = 1; + wait_us(1150); // semiperiodo del segnale da generare + dAudioOut = 0; + wait_us(1150); // semiperiodo del segnale da generare + //++++++++++++++++++ FINE Test generazione Audio con segnale digitale ++++++++++++++++++++++++ + + // Accende LED per diagnostica della Board + if(OnBoardButton == 1) // se Button Blu sulla scheda è premuto OnBoardButton = 1 + { + OnBoardRedLED=1; + OnBoardBlueLED=1; + OnBoardGreenLED=1; + } + } +}
--- a/main.cpp Tue Jan 23 10:14:58 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -#include "mbed.h" - -// dimensione del pacchetto di comunicazione tra PC e uC -#define PACKETDIM 33 - -DigitalOut led(LED1); -Serial pc(SERIAL_TX, SERIAL_RX); - -// indice per i cicli -int nIndex; - -// indice dell'array caRxPacket[] -volatile int nRxIndex; -// carattere in arrivo dal PC -volatile char caReadChar; - -// paccchetto ricevuto dal PC -char caRxPacket[PACKETDIM]; -int nRxPacketSize; - -void RxInterrupt(void) -{ - // reset pacchetto ricevuto - nIndex=0; - for(nIndex=0;nIndex<PACKETDIM;nIndex++) - { - caRxPacket[nIndex]='\0'; - } - - // ricevi caratteri su seriale, se disponibili - while((pc.readable())) - { - pc.gets(caRxPacket,sizeof(caRxPacket)); - nRxPacketSize = strlen(caRxPacket); - //pc.printf("*** pc.readable = %2d \n\r",nRxPacketSize); - //pc.scanf("%s", &caRxPacket); - //+++pc.putc(pc.getc()); // read data from UART - - } - //+++pc.printf("%s",caRxPacket); - pc.printf("You also say goodbye to yours tk"); -} - -int main() -{ - // configura velocità della comunicazione seriale su USB-VirtualCom e invia messaggio di benvenuto - //pc.baud(921600); //921600 bps - pc.baud(256000); //9600 bps - //pc.printf("*** SineWave Generation ***\n\r"); - - pc.attach(&RxInterrupt,Serial::RxIrq); - - while(true) - { - led = !led; // Toggle LED - } -} \ No newline at end of file
--- a/mbed.bld Tue Jan 23 10:14:58 2018 +0000 +++ b/mbed.bld Mon Feb 03 10:51:25 2020 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/22da6e220af6 \ No newline at end of file +https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc \ No newline at end of file