Using Bluefruit EZ-Link with Flora

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
zebular13
 
Posts: 1
Joined: Tue Jun 10, 2014 5:32 pm

Using Bluefruit EZ-Link with Flora

Post by zebular13 »

Hi,

I built an android app that controls an RGB LED via bluetooth. I'm using the Bluefruit EZ-Link. When originally I breadboarded it using an Arduino Uno, everything worked fine.

Next, I attempted to move it to the Flora. I wired pins D12,D10 & D9 to the RGB Led. The Bluefruit EZ LINK has RX, TX, VIN & GND wired to TX, RX, 3.3V & GND respectively. I can successfully connect my Bluefruit to my Android (or my Macbook).
However, when I try to send data from the android to the Bluefruit, not only does the RGB LED not light up - the TX LED on the Bluefruit doesn't light up either!

I took everything apart and put it back together with the UNO, and sure enough, everything works fine and the TX LED lights up when I transmit data via the app.

I tried modifying the sketch to use Serial1 instead of Serial, but that didn't help either.

Here is my arduino code:

Code: Select all

//PWM pins for the LEDs
#define redpin 10
#define greenpin 12
#define bluepin 9


//color variables 
int redvalue=0;
int greenvalue=0;
int bluevalue=0;

void setup(){ 
  //configure pins
 
  pinMode(redpin, OUTPUT);
  pinMode(greenpin, OUTPUT);
  pinMode(bluepin, OUTPUT);
  //check for proper baud rate
  Serial1.begin(9600);
} 


void loop() {
  //App Inventor sends three bytes (RGB, 0 to 255).
  if ( Serial1.available() > 2){
    //make sure it's 3 bytes
    if ( Serial1.available() == 3){
      //read each of the 3 bytes for brightness into the variables
      redvalue=Serial1.read(); 
      greenvalue=Serial1.read();
      bluevalue=Serial1.read();
      //flush the buffer
      Serial1.flush();
    } 
    else {
      //if the data is not 3 bytes treat it as invalid and flush the buffer.
      Serial1.flush();
    }
  } 
  //write the current values to the pwm pins.
  analogWrite(redpin, redvalue);
  analogWrite(greenpin, greenvalue);
  analogWrite(bluepin, bluevalue);
}
Does the TX LED not lighting up mean that there is a problem with the RX pin on the Flora?
Also, I know the other pins on the Flora are working - I've sent several test sketches without Bluetooth and they work fine.

User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: Using Bluefruit EZ-Link with Flora

Post by adafruit2 »

What happens if you try to send data from the Flora with Serial1? also try powering it from VBAT not 3.3V (it shouldn't matter but worth trying a better power supply)

User avatar
jrajko
 
Posts: 7
Joined: Sun Aug 24, 2014 12:37 pm

Re: Using Bluefruit EZ-Link with Flora

Post by jrajko »

We had a similar problem in that data was transimitting between the computer and bluefruit ez-link, but it would not transmit between the flora and the ez-link. We tried a lot of troubleshooting, but no success. However, we found success when working with the soft serial library.

Code: Select all

#include <SoftwareSerial.h>  
SoftwareSerial bluetooth(9, 6); //RX, TX

void setup(void) 
{
  bluetooth.begin(9600); 

  // use "bluetooth" instead of "Serial"
}
I don't know if this is a common flora problem, but it seems like the flora buffers all of the serial communication until a connection is made over usb. I don't know if this contributes to the ez-link problem, but soft serial seemed to get around whatever the problem was.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”