i'm trying to display static text to p10 led module via arduino ethernet shield please help me where i am wrong
this is my code...
Code: Select all
/*--------------------------------------------------------------------------------------
Includes
--------------------------------------------------------------------------------------*/
#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 "SystemFont5x7.h"
#include "Arial_black_16.h"
#include <Ethernet.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 125 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
// telnet defaults to port 23
EthernetServer server(23);
boolean alreadyConnected = false; // whether or not the client was connected previously
//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
/*--------------------------------------------------------------------------------------
Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
called at the period set in Timer1.initialize();
--------------------------------------------------------------------------------------*/
void ScanDMD()
{
dmd.scanDisplayBySPI();
}
String inputString = "";
char c;
void setup()
{
Ethernet.begin(mac, ip, gateway, subnet);
// start listening for clients
server.begin();
Timer1.initialize( 5000 );
Timer1.attachInterrupt( ScanDMD );
dmd.clearScreen( true );
Serial.begin(115200);
}
void loop()
{
EthernetClient client = server.available();
dmd.selectFont(Arial_Black_16);
dmd.clearScreen( true );
if(client.available())
{
c = client.read();
inputString += c;
}
char newStrings[256];
int sLength=inputString.length();
inputString.toCharArray(newStrings,sLength+1);
dmd.drawString(0,0,newStrings,sLength,GRAPHICS_NORMAL);
delay(1000);
dmd.clearScreen( false );
//dmd.drawMarquee(newStrings,sLength,(32*DISPLAYS_ACROSS)-1,0);
//
//
////dmd.drawMarquee("Scrolling Text testing",22,(32*DISPLAYS_ACROSS)-1,0);
// long start=millis();
// long timer=start;
// boolean ret=false;
// while(!ret){
// if ((timer+30) < millis()) {
// ret=dmd.stepMarquee(-1,0);
// timer=millis();
// }
// }
// delay(2);
}