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 0:3fbef2e4ddfa, committed 2017-05-23
- Comitter:
- Wonderjack996
- Date:
- Tue May 23 09:36:51 2017 +0000
- Commit message:
- programma hello world per utilizzo schield bluethoot HC05 con scheda ST
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 3fbef2e4ddfa main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue May 23 09:36:51 2017 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+
+/*I pin utilizzati per TX e RX sono pin morfo, a livello hardware collegare il pin TX dell HC05 al PA_12 e quello RX a PA_11 ( a livello harware vanno invertiti )*/
+#define TX PA_11
+#define RX PA_12
+
+Serial pc(USBTX, USBRX); //istanzio oggetto per utilizzo monitor seriale
+
+Serial device(TX, RX); //oggetto per gestione seriale bluethoot
+
+int main() {
+
+ unsigned char rx;
+
+ device.baud(9600);
+ pc.baud(9600);
+
+ while(true){
+ if( device.readable() ) { //funzione simile alla Serial.available() di arduino, solo se il monitor e` attivo permette di utilizzarlo
+ rx = device.getc(); //funzione simile alla Serial.read() di arduino, legge il carattere dal seriale del bluethoot
+ pc.printf("recived: %c \r\n",rx); //stampa a video
+ }
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 3fbef2e4ddfa mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue May 23 09:36:51 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/4eea097334d6 \ No newline at end of file