Bluefruit EZ-Link Shield issue with Soft Serial

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ryanas
 
Posts: 12
Joined: Tue Aug 26, 2014 8:10 am

Bluefruit EZ-Link Shield issue with Soft Serial

Post by ryanas »

Hi,

I am currently using the Adafruit RFID/NFC reader with the Bluefruit EZ-Link Shield. If I use the "direct" mode on the EZ-Link shield, the serial data is printed out as normal.

However, when I use the Soft Serial switch, I do not get any output.

I have tested it with a basic sketch

Code: Select all

#include <SoftwareSerial.h>  

SoftwareSerial bluetooth(8, 7); //RX, TX

void setup(void) {
  Serial.begin(115200);
  
  bluetooth.begin(9600);  // Start bluetooth serial at 9600
  bluetooth.println("Hello user");
}

void loop(void) {
        
        if(bluetooth.available()) 
  {
    // Send any characters the Serial monitor prints to the bluetooth
      bluetooth.print("Test");
  }
  delay(500);
}
The shield is mounted directly onto an Arduino Uno and this code works fine with a Bluetooth Mate.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Bluefruit EZ-Link Shield issue with Soft Serial

Post by adafruit_support_rick »

The SoftSerial switch changes serial communication to pins 7 and 8, and disconnects the normal Serial I/O pins of 0 and 1.

User avatar
ryanas
 
Posts: 12
Joined: Tue Aug 26, 2014 8:10 am

Re: Bluefruit EZ-Link Shield issue with Soft Serial

Post by ryanas »

Ok, so how do I get the EZ-link to send data via the Software Serial rather than using Serial? Serial works when using the Direct option but I want output via Software Serial.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Bluefruit EZ-Link Shield issue with Soft Serial

Post by adafruit_support_rick »

Oops - sorry. My mistake. On the EZ-Link, you have to run jumpers from the SRX and STX pads to the digital pins you want to use for software serial.
To use digital 8 and 7 for software serial, install jumpers like this:
ez-link_jumpers.png
ez-link_jumpers.png (922.12 KiB) Viewed 525 times
This sketch demonstrates how to set up Software Serial for pins 8 and 7

Code: Select all

#include <SoftwareSerial.h>

SoftwareSerial mySerial = SoftwareSerial(8,7);

void setup()
{
  mySerial.begin(9600);
  mySerial.println("Echo Test");
}

void loop()
{
  if (mySerial.available())
  {
    char c = mySerial.read();
    mySerial.write(c);
  }
}

User avatar
ryanas
 
Posts: 12
Joined: Tue Aug 26, 2014 8:10 am

Re: Bluefruit EZ-Link Shield issue with Soft Serial

Post by ryanas »

Thank you very much, the diagram and code were very helpful.

Also, it would be nice if the EZ-Link Shield had some form of tutorial (not including the EZ-Link module tutorial) for beginners. Other than that, great piece of kit for cheap.

User avatar
zari0n
 
Posts: 14
Joined: Mon Mar 31, 2014 2:56 pm

Re: Bluefruit EZ-Link Shield issue with Soft Serial

Post by zari0n »

Hi ryanas,
searching around for some code for this realy beautiful Bluetooth Serial Link, I found your post.
Here is the results of my work today to talk from Androit with BlueTerm to Arduino.
Maybe it'll take you further:

Code: Select all

#include <SoftwareSerial.h>

SoftwareSerial mySerial = SoftwareSerial(8,7);



int mode,a,i;
char c;
float float_a, float_b;
char* myStrings[]={"Adafruit", "Ladyada", "Bluefruit","Arduino", "Open Source","Beta Test"};
char* info = {"\n[1]number (int) - [2]char (5 times) - [3]string \n[4] float out - [5]float in - [6] enter string"};
char* test[5]={};

void setup()
{
  randomSeed(0);
  mySerial.begin(9600);
  mySerial.println("Bluetooth Serial Test with\nBluefruit EZ-Link\n");
  mySerial.println(info);
}

void loop()
{
  if (mySerial.available()){

    mode = mySerial.parseInt();    // get integer -> with your selection
    
    switch(mode){
    case 1:                                     // send integer value to Arduino and back
      mySerial.print("enter value: \n");
      while(!mySerial.available()) delay(1);    // wait till there is a input
      a = mySerial.parseInt();
      mySerial.print("value was: ");
      mySerial.print(a);
      mySerial.println(info);                   // print info again..
      break;

    case 2:
      mySerial.print("enter char: \n");        // sends 5 times one char to Arduino and back
      
      for(i = 1; i<6;i++){                     
        
        while(!mySerial.available()) delay(1);
        c = mySerial.read();
        mySerial.print(i);
        mySerial.print(".-char was: ");
        mySerial.print(c);
        mySerial.println();
      }
      mySerial.println(info);
      break;

    case 3:
      for (int i = 0; i < 6; i++){
        mySerial.println(myStrings[i]);      // strings works too
        delay(200);
      }
      mySerial.println(info);
      break;

    case 4:
      mySerial.println("float: ");          // arduino send one flote value
      float_a = random();
      float_b = random();
      mySerial.print(float_a / float_b);
      break;

    case 5:
      mySerial.println("give me a float");        // send one folat to Arduino
      while(!mySerial.available()) delay(1);
      float_a = mySerial.parseFloat();
      mySerial.println(float_a);
      mySerial.println(info);
      break; 

    case 6:
      mySerial.println("enter string: (not finished...)");        //send a string to Arduino does not work, yet... 
      //while(!mySerial.available());
      //mySerial.readBytes(a,test,5);                             // Serial.readBytes does not work with SoftwareSerial :(
      mySerial.println(info);
      break;

    default:
      mySerial.println("\ndefault\n");
      mySerial.println(info);
    }
  }

  else delay(100);
}

My question or problem is only if it is normal that have to disconnect EZ-Link from Arduino bevor i can successfully upload a new sketch?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Bluefruit EZ-Link Shield issue with Soft Serial

Post by adafruit_support_rick »

zari0n wrote:My question or problem is only if it is normal that have to disconnect EZ-Link from Arduino bevor i can successfully upload a new sketch?
Not sure what you mean. Do you mean *physically* disconnect the EZ-Link? No, that's not normal.

User avatar
zari0n
 
Posts: 14
Joined: Mon Mar 31, 2014 2:56 pm

Re: Bluefruit EZ-Link Shield issue with Soft Serial

Post by zari0n »

Yes, physically disconnect or to unplugged the EZ-Link to be exact.
Otherwise I get this warning: avrdude: stk500_getsync(): not in sync: resp=0x00
And yes: com port, target device and programmer as usual.

Next, i will reburn the bootloader.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Bluefruit EZ-Link Shield issue with Soft Serial

Post by adafruit_support_rick »

You will get that error sometimes. I just try programming again, and it will usually go.

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

Return to “Arduino Shields from Adafruit”