summaryrefslogtreecommitdiff
path: root/ESS1995test_328p/adapticsBT.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2011-12-19 18:20:33 +0000
committerTim Redfern <tim@eclectronics.org>2011-12-19 18:20:33 +0000
commite9a73bbb3c14af340999f70146747787785f4fee (patch)
treea125452f7d641673286542497da051b810427880 /ESS1995test_328p/adapticsBT.cpp
initial commit
Diffstat (limited to 'ESS1995test_328p/adapticsBT.cpp')
-rw-r--r--ESS1995test_328p/adapticsBT.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/ESS1995test_328p/adapticsBT.cpp b/ESS1995test_328p/adapticsBT.cpp
new file mode 100644
index 0000000..c5113f9
--- /dev/null
+++ b/ESS1995test_328p/adapticsBT.cpp
@@ -0,0 +1,50 @@
+/*
+ Adaptics BT platform
+
+11/11/11
+ persistent connection with a BT serial module
+ this WAS working well with precompiled library and setting the baudrate artificially to 76800 (because F_CPU not working)
+ although println(unsigned long) was causing an error.
+ what's changed :-(
+
+15/11/11
+ using 38400 and non precomiled- sucessfully enters inquiry
+ can only seem to connect straight after pairing, which is annoying
+ when connected the BT module sends some fragments of commands ie.e "+STOAU\0xf4"
+ it only seems to stay connected for 1/2 second. Voltage issue?
+
+ yep- it works on 0v-3v but ont on -3v-0v
+ -3v seems to kind of work at 9600bps - received junk
+ at 19200 it stays on for a few seconds but received junk
+
+*/
+
+#include "adapticsBT.h"
+
+void setupBlueTooth(){
+
+ pinMode(BTC,INPUT); //connection indicator
+
+ Serial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
+
+ Serial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
+ Serial.print("\r\n+STNA=AdapticsElectic\r\n"); //set the bluetooth name
+ Serial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
+ Serial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
+
+ //necessary?
+ Serial.print("\r\n +STPIN=0000\r\n"); //"\r\n+DLPIN\r\n");
+ Serial.print("\r\n+LOSSRECONN=0\r\n"); //setting this to 1 seems to stop it working
+
+ advertise();
+
+}
+void advertise(){
+ delay(2000); // This delay is required - its really 2 seconds
+ Serial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
+
+ delay(2000); // This delay is required.
+
+ Serial.flush();
+
+}