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-src MODSERIAL
Revision 0:7bb229e58814, committed 2012-05-31
- Comitter:
- edodm85
- Date:
- Thu May 31 19:52:52 2012 +0000
- Child:
- 1:a11db105c379
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Thu May 31 19:52:52 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/AjK/code/MODSERIAL/#c11ea36f17f9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu May 31 19:52:52 2012 +0000
@@ -0,0 +1,58 @@
+/*
+ * Author: Edoardo De Marchi
+ * Date: 31-05-12
+ * Notes: AT command
+*/
+
+#include "mbed.h"
+#include "MODSERIAL.h"
+
+
+MODSERIAL pc(USBTX, USBRX); // tx, rx
+MODSERIAL blue(p9,p10); // HC05
+DigitalOut led1(LED1);
+DigitalOut led4(LED4);
+
+
+void commandAT(char *v){
+
+ int i=0;
+
+ while(v[i] != NULL){
+ blue.putc(v[i]);
+ i++;
+ }
+
+ blue.printf("\r\n");
+}
+
+
+// This function is called when a character goes into the RX buffer.
+void rxCallback(MODSERIAL_IRQ_INFO *q) {
+ led4 = !led4;
+ pc.putc(blue.getc());
+}
+
+
+int main(){
+
+ blue.baud(38400);
+ pc.baud(115200);
+
+ char s[80];
+
+ while(1){
+ pc.printf("Command: ");
+ pc.scanf("%s",s);
+
+ wait_us(100);
+
+ commandAT(s);
+ wait_us(100);
+
+ pc.printf("Response: ");
+
+ blue.attach(&rxCallback, MODSERIAL::RxIrq);
+ wait(1);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 31 19:52:52 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479
Bluetooth HC-05