SMS based LED matrix display using sim900

Greetings

Sir/Madam;

Please help me to fix my code, there is no problem with the hardware, because i have already display message on the LED matrix.
The problem is the GSM part, when I send text message on the GSM for it to display, it cannot read the message and it cannot display on the LED matrix. please help,.

Your kind consideration is highly appreciated. Thank you so much.

Here is my code:

#include <SoftwareSerial.h>
#include <cmap.h>
#include <string.h>
#include <HardwareSerial.h>

int d;

unsigned char char_pointer;
char Display_Ram[102]; //if nadagdagan pa to, iilaw na lahat ang matrix and no running message na ngyayari
int a = (sizeof(Display_Ram)-6); //128 number of columns 4 matrices so far.
unsigned char mask;
char LED_DATA = “Welcome!!!”;
//String password = “SPCF”;
//String = password + LED_DATA;
char count;
char gsmInfo[100];
char temp[255];
unsigned char shift_counter;
int space=0;
unsigned char Rx[250];
extern char Sender[10];

int rxPin = 0;
int txPin = 1;

//char smsbuffer[160];

SoftwareSerial gsm = SoftwareSerial(rxPin,txPin);

#define INTEN 2000

const char CLK = 5;
const char DAT = 6;
const char STR = 7;
const char K0 = A0;
const char K1 = A1;
const char K2 = A2;
const char K3 = A3;
const char K4 = 8;
const char K5 = 9;
const char K6 = 10;
const char K7 = 11;

void setup() {
gsm.begin(19200);
pinMode(CLK, OUTPUT);
pinMode(DAT, OUTPUT);
pinMode(STR, OUTPUT);
pinMode(K0, OUTPUT);
pinMode(K1, OUTPUT);
pinMode(K2, OUTPUT);
pinMode(K3, OUTPUT);
pinMode(K4, OUTPUT);
pinMode(K5, OUTPUT);
pinMode(K6, OUTPUT);
pinMode(K7, OUTPUT);

pinMode(rxPin,INPUT);
pinMode(txPin,OUTPUT);

digitalWrite(K0,HIGH);
digitalWrite(K1,HIGH);
digitalWrite(K2,HIGH);
digitalWrite(K3,HIGH);
digitalWrite(K4,HIGH);
digitalWrite(K5,HIGH);
digitalWrite(K6,HIGH);
digitalWrite(K7,HIGH);

gsm.write(“AT\r”);
delay(1000);
gsm.write(“ATE0\r”);
delay(1000);
gsm.flush();
gsm.write(“AT+CFUN=1\r”);
delay(1000);
gsm.flush();
gsm.write(“AT+CSDH=0\r”);
delay(1000);
gsm.write(“AT+CMGF=1\r”); //0 kapag PDU, 1 kapag text
delay(1000);
gsm.flush();

for(d=0;d<a;d++)
{
clock();
}
strobe();

}

void loop(){

Display();
shift();

}

void Display(void)
{
mask = 0x01;
scan();
digitalWrite(K7,LOW);
for(d=0;d<INTEN;d++){
}
digitalWrite(K7,HIGH);

mask = 0x02;
scan();
digitalWrite(K6,LOW);
for(d=0;d<INTEN;d++){
}
digitalWrite(K6,HIGH);

mask = 0x04;
scan();
digitalWrite(K5,LOW);
for(d=0;d<INTEN;d++){
}
digitalWrite(K5,HIGH);

mask = 0x08;
scan();
digitalWrite(K4,LOW);
for(d=0;d<INTEN;d++){
}
digitalWrite(K4,HIGH);

mask = 0x10;
scan();
digitalWrite(K3,LOW);
for(d=0;d<INTEN;d++){
}
digitalWrite(K3,HIGH);

mask = 0x20;
scan();
digitalWrite(K2,LOW);
for(d=0;d<INTEN;d++){
}
digitalWrite(K2,HIGH);

mask = 0x40;
scan();
digitalWrite(K1,LOW);
for(d=0;d<INTEN;d++){
}
digitalWrite(K1,HIGH);

mask = 0x80;
scan();
digitalWrite(K0,LOW);
for(d=0;d<INTEN;d++){
}
digitalWrite(K0,HIGH);

}

void shift(void)
{
unsigned char io = 0;

for(io=0;io<a+5;io++)
{
Display_Ram[io] = Display_Ram[io+1];
}
shift_counter++;
if(shift_counter == 6){
shift_counter = 0;
load();
}
}

void load(void){
char counter1;
if(LED_DATA[char_pointer] == 0x00)
{
char_pointer = 0;
space= 16;
}
for(counter1 = 0; counter1 < 6; counter1++)
{
if(space>0)
{
Display_Ram[a + counter1] = 0x00;
}
else

Display_Ram[a + counter1] = character_data[(LED_DATA[char_pointer] - 0x20)][counter1];
}
Display_Ram[a+5] = 00;
char_pointer++;

if(space==1)
{
if(gsm.available())
readSMS1();

// Check_SMS();
}

if(space>0)
{
space–;
char_pointer = 0;
}

}

void Clear_Display_Ram(void){
unsigned char rcount;
for(rcount = 0; rcount < a+5; rcount++)
Display_Ram[rcount] = 0xff;
}

void scan(void){
for (count=a;count>(-1);count–){
if ((Display_Ram[count] & mask) == mask)
digitalWrite(DAT,LOW);
else
digitalWrite(DAT,HIGH);
clock();
}
strobe();

}

void clock(void){
digitalWrite(CLK,HIGH); // clock hi
digitalWrite(CLK,LOW); // clock low
}

void strobe(void){
digitalWrite(STR,HIGH); // strobe hi
digitalWrite(STR,LOW); // strobe low
}

void readSMS1(void){

int newline=0;
int ctrLED=0;
char incoming;

gsm.flush();
gsm.write(“AT+CMGR=1\r”); //sends AT command to read the contents of inbox 1
delay(2000);

if(gsm.available()>0)
{

memset(LED_DATA,0x00,255); //clear string for space

while(gsm.available()>0)
{
incoming = gsm.read(); //reads the character in the serial buffer
if(incoming==’\n’)
newline++;
else if(incoming==’\r’)
incoming=0x00;
else
{
if(newline==2) //saves the characters in the serial buffer after the 2nd ‘\n’
LED_DATA[ctrLED] = incoming;
ctrLED++;
}
}
}
deleteSMS();
}

void sendSMS(const char* theNumber,const char* theString)
{
gsm.write(“AT+CMGS=”");
gsm.write(theNumber);
gsm.write(""\r");
delay(1000);
gsm.write(theString);
delay(1000);
// End the SMS with a control-z
gsm.write(0x1A);
}

/delete messages function*/

void deleteSMS(void)
{
gsm.write(“AT+CMGD1=“DEL 1”\r”);
delay(1000);
}

int a = (sizeof(Display_Ram)-6);   //128 number of columns 4 matrices so far.

What does this comment have to do with this code?

  gsm.write("AT\r");
  delay(1000);
  gsm.write("ATE0\r");
  delay(1000);
  gsm.flush();
  gsm.write("AT+CFUN=1\r");
  delay(1000);
  gsm.flush();
  gsm.write("AT+CSDH=0\r");
  delay(1000);
  gsm.write("AT+CMGF=1\r");  //0 kapag PDU, 1 kapag text
  delay(1000);
  gsm.flush();

Send a bunch of commands to the modem. What the modem says in response is completely irrelevant. I don't think so!

The problem is the GSM part, when I send text message on the GSM for it to display, it cannot read the message and it cannot display on the LED matrix.

How do you know this? There is no debug code anywhere in that sketch.

have you had any luck on this? i'm working on a similar project too.