From 1e2a1faf957cb27cd47828d59ce18462eaf16536 Mon Sep 17 00:00:00 2001 From: Christopher Stone Date: Tue, 6 Mar 2018 19:53:29 +0000 Subject: [PATCH] Copied in serial forwarder code, which is very useful for configuring the HC-05 bluetooth module. From techbitar.com, public domain. --- robots/little_john/telemetry/code/serial_forwarder/serial_forwarder.ino | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+), 0 deletions(-) create mode 100644 robots/little_john/telemetry/code/serial_forwarder/serial_forwarder.ino diff --git a/robots/little_john/telemetry/code/serial_forwarder/serial_forwarder.ino b/robots/little_john/telemetry/code/serial_forwarder/serial_forwarder.ino new file mode 100644 index 0000000..806f9ac --- /dev/null +++ b/robots/little_john/telemetry/code/serial_forwarder/serial_forwarder.ino @@ -0,0 +1,33 @@ +/* + +AUTHOR: Hazim Bitar (techbitar) +DATE: Aug 29, 2013 +LICENSE: Public domain (use at your own risk) +CONTACT: techbitar at gmail dot com (techbitar.com) + +*/ + +#include + +SoftwareSerial BTSerial(3, 2); // RX | TX + +void setup() +{ + pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode + digitalWrite(9, HIGH); + Serial.begin(9600); + Serial.println("Enter AT commands:"); + BTSerial.begin(38400); // HC-05 default speed in AT command more +} + +void loop() +{ + + // Keep reading from HC-05 and send to Arduino Serial Monitor + if (BTSerial.available()) + Serial.write(BTSerial.read()); + + // Keep reading from Arduino Serial Monitor and send to HC-05 + if (Serial.available()) + BTSerial.write(Serial.read()); +} -- libgit2 0.21.2