PDA

View Full Version : Help Shield Connection



Jen17
04-30-2014, 12:48 AM
How to fix this problem with Arduino, GSM and Bluetooth Shield. i used the default configuration of GSM Shield Library with the connection TX(2)-RX(3) while the BT shield Connection is TX(1)-RX(0)., but when i power them ON the BT shield state is in Debug mode.


#include "sms.h"
#include "SoftwareSerial.h"
SMSGSM sms;

char n[20]={" 5627562233"};
char smsbuffer[160];
int Button= 8;
boolean started=false;

char incomingByte; // incoming data

void setup(){

Serial.begin(9600);
if (gsm.begin(9600)){
started=true;
}

pinMode(Button, OUTPUT);
}

void loop(){
sms();
BT();
}

void sms(){

char position;
position = sms.IsSMSPresent(SMS_UNREAD);
if (position>0){

memset(smsbuffer, 0, 160);
if(sms.GetSMS(position, n, smsbuffer, 169)>0)
{
if(strstr(smsbuffer,"1") != NULL){
Serial.println("LED1 ON!"); // print message
sms.DeleteSMS(position);
}
else if(strstr(smsbuffer,"0") != NULL){
Serial.println("LED1 OFF!"); // print message
sms.DeleteSMS(position);
}
}

void BT(){
incomingByte = Serial.read(); // read byte
if(incomingByte == '1') {
Serial.println("LED1 ON!"); // print message

}
if(incomingByte == '0') {
Serial.println("LED1 OFF!"); // print message }