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.
Diff: main.cpp
- Revision:
- 0:0e236e004748
- Child:
- 1:e73a7c99f767
diff -r 000000000000 -r 0e236e004748 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Dec 02 13:21:04 2017 +0000
@@ -0,0 +1,59 @@
+/*
+ * Author: G. Pathuis
+ * Date: 02-12-17
+ * Notes: HC05 connected to a KL25Z
+ * Pair with PC use password 1234
+ *
+ * Four wire connection
+ * HC05 to KL25Z
+ * GND to GND
+ * +5V to 5V
+ * TX to pin PTE0
+ * RX to pin PTE1
+ *
+ * Open Tera Term session to connect to KL25Z
+ * and
+ * Open second Tera Term session to read the Bluetooth
+ * dongle in the PC
+ *
+ * Make sute Tera Term uses 9600 baud
+*/
+
+#include "mbed.h"
+
+
+Serial pc(USBTX, USBRX);
+Serial blue(PTE0, PTE1); // TX, RX
+
+DigitalOut myled(LED1);
+DigitalOut myled2(LED2);
+
+
+int main()
+{
+ int i =0;
+ blue.baud(9600); // Default Bluetooth Baudrate
+ pc.baud(9600);
+
+ pc.printf("Bluetooth Start\r\n");
+
+ // Write from Bluetooth to PC
+ for (i=0; i<10; i++) {
+ blue.printf("Hello PC this is the HC-05, %d\n\r", i);
+ myled = !myled;
+ }
+ wait(1);
+
+ // Echo back characters and toggle the LED
+ while (1) {
+ if (blue.readable()) {
+ pc.putc(blue.getc());
+ myled = !myled;
+ }
+ if (pc.readable()) {
+ blue.putc(pc.getc());
+ myled2 = !myled2;
+ }
+ wait_ms(10);
+ }
+}
\ No newline at end of file