I can't see anything on the dmd panel when i add ethercard code. Without ethernet i can type something on dmd p10 panels. Where is my mistake? At the ether.begin function i write 10 for spi chip select even thought i can't see any text on panels.
Code: Select all
#include <EEPROM.h>
#include <Wire.h>
#include "RTClib.h"
#include <SPI.h>
#include <DMD.h>
#include <TimerOne.h>
#include <EtherCard.h>
#include <IPAddress.h>
#include "SystemFont5x7.h"
#include "Font_6x14.h" //-> This font only contains numbers from 0-9
#define DISPLAYS_ACROSS 2 //-> Number of P10 panels used, side to side.
#define DISPLAYS_DOWN 2
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
//#define SPI_SS 10
int kAdres1=11;
String bb;
//------------------------------------------------------------------------------
#define STATIC 1 // set to 1 to disable DHCP (adjust myip/gwip values below)
#if STATIC
// Ethernet interface IP address
static byte myip[] = { 192,168,1,175 };
// Gateway IP address
static byte gwip[] = { 192,168,1,1 };
static byte mask[] = { 255,255,255,0 };
static byte dnss[] = { 192,168,1,1 };
#endif
// Ethernet MAC address - must be unique on your network
static byte mymac[] = { 0x70,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[500]; // TCP/IP send and receive buffer
/*
// Callback that prints received packets to the serial port
void udpSerialPrint(uint16_t dest_port, uint8_t src_ip[IP_LEN], uint16_t src_port, const char *data, uint16_t len){
IPAddress src(src_ip[0],src_ip[1],src_ip[2],src_ip[3]);
Serial.print("dest_port: ");
Serial.println(dest_port);
Serial.print("src_port: ");
Serial.println(src_port);
Serial.print("src_ip: ");
ether.printIp(src_ip);
Serial.println("data: ");
Serial.println(data);
char textToSend[] = "AABBCCDDEEFFGGHH";
//src_ip
ether.sendUdp(textToSend, sizeof(textToSend), src_port, src_ip, dest_port );
}*/
//--------------------------------------------------------------------------------------
RTC_DS1307 rtc; //-> RTC Declaration
char msg1[]="HELLO";
char data[] = "HELLO HELLO";
//--------------------------------------------------------------------------------------ScanDMD()
void ScanDMD() {
dmd.scanDisplayBySPI();
}
//--------------------------------------------------------------------------------------setup
void setup() {
Serial.begin(9600);
delay(1000);
Timer1.initialize(1000);
Timer1.attachInterrupt(ScanDMD);
dmd.clearScreen(true);
ether.begin(sizeof Ethernet::buffer, mymac, 10);
// Change 'SS' to your Slave Select pin if you aren't using the default pin
if (ether.begin(sizeof Ethernet::buffer, mymac, SS) == 0)
Serial.println(F("Failed to access Ethernet controller"));
#if STATIC
ether.staticSetup(myip, gwip, dnss, mask);
#else
if (!ether.dhcpSetup())
Serial.println(F("DHCP failed"));
#endif
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
Register udpSerialPrint() to port 1337
// ether.udpServerListenOnPort(&udpSerialPrint, 3000);
}
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------loop
void loop() {
ether.packetLoop(ether.packetReceive());
dmd.selectFont(SystemFont5x7);
dmd.drawChar(1,1,data[2] ,1,GRAPHICS_NORMAL); // bura bak
delay(2000);
}
}