16*32 led display with gsm 900Amodule
Posted: Thu Mar 23, 2017 2:13 am
hi,
I am doing a project on printing gsm message on led dispaly.
I got the message printed on a single led disaply ,but when i tried using more than one dispaly
i am not even getting the gsm message on the serial monitor.
can anyone help me
I am doing a project on printing gsm message on led dispaly.
I got the message printed on a single led disaply ,but when i tried using more than one dispaly
i am not even getting the gsm message on the serial monitor.
Code: Select all
#include <SoftwareSerial.h>
#include <SPI.h> //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <DMD.h> //
#include <TimerOne.h> //
#include "Arial_black_16.h"
//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
//when i tried using#define DISPLAYS_ACROSS 2 i got trouble
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
SoftwareSerial mySerial(5, 10);
char mes[500];
char ch;
int temp=0;
int j,i=0,t=0,k=0;
void ScanDMD()
{
dmd.scanDisplayBySPI();
}
void setup()
{
mySerial.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
//initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
Timer1.initialize( 5000 ); //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
Timer1.attachInterrupt( ScanDMD ); //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()
//clear/init the DMD pixels held in RAM
dmd.clearScreen( true ); //true is normal (all pixels off), false is negative (all pixels on)
//delay(1000);
}
void loop()
{ byte b;
dmd.selectFont(Arial_Black_16);
if (Serial.available()>0)
switch(Serial.read())
{
case 's':
SendMessage();
break;
case 'r':
RecieveMessage();
break;
}
while(mySerial.available()>0)
{temp=0;
i=0;
while(mySerial.available()>0)
{
ch=mySerial.read();
if(ch=='"')
temp++;
if(temp>=7)
{
mes[i]=ch;
i=i+1;
}
if(temp==6)
temp++;
Serial.write(ch);
}
mes[i]='\0';
i++;
}
while(i>j)
{Serial.write(mes[j]);
j++;
}
j=0;
if(temp>6)
{ dmd.drawMarquee(mes,strlen(mes),(32*DISPLAYS_ACROSS)-1,0);
long start=millis();
long timer=start;
boolean ret=false;
while(!ret){
if ((timer+100
) < millis()) {
ret=dmd.stepMarquee(-1,0);
timer=millis();
}
}
}
}
void RecieveMessage()
{
mySerial.println("AT+CNMI=2,2,0,0,0");
delay(1000);
}
void SendMessage()
{
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
mySerial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile number
delay(1000);
mySerial.println("I am SMS from GSM Module");// The SMS text you want to send
delay(100);
mySerial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}