rbhollabaugh
Member
Hi All,
Ethernet stopped working when I went from Teensy 1.40 to 1.41. When I run arp I get "(incomplete)" for the MAC address. The other clue is that the GLCD.Print(After Begin) takes about 1 or 2 seconds with 1.40 but happens immediately with 1.41. Libraries used were all teensduino supplied except for openGLCD.
Any suggestions?
Here's the code:
Ethernet stopped working when I went from Teensy 1.40 to 1.41. When I run arp I get "(incomplete)" for the MAC address. The other clue is that the GLCD.Print(After Begin) takes about 1 or 2 seconds with 1.40 but happens immediately with 1.41. Libraries used were all teensduino supplied except for openGLCD.
Any suggestions?
Here's the code:
Code:
#include <SPI.h>
#include <openGLCD.h>
#include <Ethernet.h>
#define BACKLIGHT_PIN 0
#define WIZNETRESET_PIN 24
byte mac[] = { 0xDE, 0xDE, 0xDE, 0xDE, 0xDE, 0xE0 };
//IPAddress ip{192, 168, 5, 50};
EthernetServer server(80);
void setup()
{
BackLight(255);
GLCD.Init();
GLCD.ClearScreen();
GLCD.SelectFont(System5x7, BLACK);
GLCD.CursorTo(0,0); /* col row */
GLCD.Puts("Ethernet Test");
pinMode(WIZNETRESET_PIN, OUTPUT);
digitalWrite(WIZNETRESET_PIN, LOW);
delay(1);
digitalWrite(WIZNETRESET_PIN, HIGH);
delay(1);
Ethernet.begin(mac); //, ip);
server.begin();
GLCD.CursorTo(0,1); /* col row */
GLCD.Printf("%s", "after begin");
}
void loop()
{
char *buf;
byte cnt = 0;
int x = 0;
EthernetClient client = server.available();
if (client)
{
if(client.connected())
{
x=0;
cnt = client.available();
buf = (char*)calloc(cnt+1, sizeof(char));
GLCD.CursorTo(0, 1);
GLCD.Printf("cnt=%d", cnt);
GLCD.CursorTo(0, 2);
for(x=0; x<cnt; x++)
{
buf[x] = client.read();
GLCD.Printf("%c", buf[x]);
}
buf[cnt] = NULL;
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.println(cnt);
client.println(buf);
free(buf);
}
// give the web browser time to receive the data
delay(1);
client.stop();
}
}
void BackLight(byte pwm_value)
{
analogWrite(BACKLIGHT_PIN, pwm_value);
}