Hi, well Im having problems, trying to connect a BT shield 2.2 (http://imall.iteadstudio.com/im120417010.html).
The connection is between the itead shield and Arduino YUN, Im trying to configure through Coolterm, but dont respond.
I tried with Arduino UNO and works very well, but I use YUN, didnt work.
This is my code:
#include <SoftwareSerial.h>
SoftwareSerial BT(1, 0);
// creates a "virtual" serial port/UART
// connect BT module TX to D0
// connect BT module RX to D1
// connect BT Vcc to 5V, GND to GND
void setup()
{
// set digital pin to control as an output
pinMode(13, OUTPUT);
// set the data rate for the SoftwareSerial port
BT.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
}
String a; // stores incoming character from other device
void loop()
{
if (BT.available())
// if text arrived in from BT serial...
{
a=BT.readString();
if (a.equals("ON"))
{
digitalWrite(13, HIGH);
BT.write("LED on from Arduino~");
}
if (a.equals("OFF"))
{
digitalWrite(13, LOW);
BT.write("LED off from Arduino~");
}
// you can add more "if" statements with other characters to add more commands
}
}
Im tried to change Serial to Serial1, but its the same... dont works.
Maybe I forgot a configuration in Arduino YUN... or my code is not the best.