Skip to content

Instantly share code, notes, and snippets.

@tuttelikz
Created March 12, 2018 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuttelikz/ac8ec593f05a03552384129e4f251582 to your computer and use it in GitHub Desktop.
Save tuttelikz/ac8ec593f05a03552384129e4f251582 to your computer and use it in GitHub Desktop.
Script to establish bluetooth connection with android and arduino.
//http://www.martyncurrey.com/arduino-and-hc-06-zs-040/
#include <SoftwareSerial.h>
SoftwareSerial BTserial(10,11); // RX | TX
void setup()
{
Serial.begin(9600);
Serial.println("Enter AT commands:");
BTserial.begin(9600);
}
void loop()
{
if (BTserial.available())
{
Serial.write(BTserial.read());
}
// Keep reading from Arduino Serial Monitor and send to HC-06
if (Serial.available())
{
BTserial.write(Serial.read());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment