0

Flora + HC-06 Bluetooth
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Flora + HC-06 Bluetooth

by pat__reis on Wed Feb 17, 2021 12:33 pm

Hi Adafruit! I'm doing a wearable project in which I need the Flora to trigger a vibration motor sent by a VR app (made with Unity and installed on Oculus Quest). HC-06 is working very good with Arduino but somehow not with Flora. (Flora attached to HC-=6 through pins RX and TX on board) As looking into Flora and Serial topics on posts I came across the need of using Serial1. I adapted the code for the following but still no success. Any idea? Thanks in advance!

Code: Select all | TOGGLE FULL SIZE
#define mySerial Serial1

int ledpin=6; // led on D13 will show blink on / off

int BluetoothData; // the data given from Computer

void setup() {

Serial.begin(9600);

Serial.println("Type AT commands!"); // put your setup code here, to run once:

mySerial.begin(9600);

Serial.println("Bluetooth On please press 1 or 0 blink LED ..");

pinMode(ledpin,OUTPUT);

}

void loop() {


if (mySerial.available()) {

BluetoothData=mySerial.read();

if(BluetoothData=='1') { // if number 1 pressed ….

digitalWrite(ledpin,1);
delay(5000);

Serial.println("LED ON");

}

if (BluetoothData =='0') { // if number 0 pressed ….

digitalWrite(ledpin,0);

Serial.println("LED  OFF ");

}

}

delay(100);// prepare for next data …

}
pat__reis
 
Posts: 11
Joined: Sun May 19, 2013 6:30 am

Please be positive and constructive with your questions and comments.