Hallo zusammen
Ich bin nun endlich mal dazu gekommen alles zusammen zu bauen Gehäuse Steckdosen usw..
Nun habe ich folgendes Problem:
Wenn ich mehr als zwei Relay schalten will geht gar nichts mehr, endweder ich bekomme im Browser nur Unfug angezeigt oder
er lädt die Website des Ethernetshields gar nicht erst.
Mein Code:
#include "etherShield.h"
#include "ETHER_28J60.h"
int outputPin1 = 4; // Relay SchaltPIN 1
int outputPin2 = 5; // Relay SchaltPIN 2
int outputPin3 = 6; // Relay SchaltPIN 3
int outputPin4 = 7; // Relay SchaltPIN 4
static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24}; // Ethernet Shield MAC Adresse
static uint8_t ip[4] = {192, 168, 1, 20}; // Webserver IP Adresse
static uint16_t port = 80; // Webserver Port
int statuspin1 = 0;
int statuspin2 = 0;
int statuspin3 = 0;
int statuspin4 = 0;
ETHER_28J60 e;
void setup()
{
e.setup(mac, ip, port);
pinMode(outputPin1, OUTPUT);
pinMode(outputPin2, OUTPUT);
pinMode(outputPin3, OUTPUT);
/* pinMode(outputPin4, OUTPUT);*/
}
void loop()
{
char* params;
if (params = e.serviceRequest())
{
// Dose 1
e.print("<table><tr><td>Steckdose 1</td>");
if (strcmp(params, "?1=on") == 0)
{
digitalWrite(outputPin1, HIGH);
}
if (strcmp(params, "?1=off") == 0)
{
digitalWrite(outputPin1, LOW);
}
statuspin1 = digitalRead(outputPin1);
if (statuspin1 == true)
{
e.print("<td><font color=green>aktiv</font></td><td><A HREF='?1=off'>Aus</A></td>");
}
else
{
e.print("<td><font color=red>inaktiv</font></td><td><A HREF='?1=on'>An</A></td>");
}
// Dose 2
e.print("<tr><td>Steckdose 2</td>");
if (strcmp(params, "?2=on") == 0)
{
digitalWrite(outputPin2, HIGH);
}
if (strcmp(params, "?2=off") == 0)
{
digitalWrite(outputPin2, LOW);
}
statuspin2 = digitalRead(outputPin2);
if (statuspin2 == true)
{
e.print("<td><font color=green>aktiv</font></td><td><A HREF='?2=off'>Aus</A></td>");
}
else
{
e.print("<td><font color=red>inaktiv</font></td><td><A HREF='?2=on'>An</A></td>");
}
// Dose 3
e.print("<table><tr><td>Steckdose 3</td>");
if (strcmp(params, "?3=on") == 0)
{
digitalWrite(outputPin3, HIGH);
}
if (strcmp(params, "?3=off") == 0)
{
digitalWrite(outputPin3, LOW);
}
statuspin3 = digitalRead(outputPin3);
if (statuspin3 == true)
{
e.print("<td><font color=green>aktiv</font></td><td><A HREF='?3=off'>Aus</A></td>");
}
else
{
e.print("<td><font color=red>inaktiv</font></td><td><A HREF='?3=on'>An</A></td>");
}
/*
// Dose 4
e.print("<tr><td><b>Steckdose 4</b></td>");
if (strcmp(params, "?cmd4=on") == 0)
{
digitalWrite(outputPin4, HIGH);
}
if (strcmp(params, "?cmd4=off") == 0)
{
digitalWrite(outputPin4, LOW);
}
statuspin4 = digitalRead(outputPin4);
if (statuspin4 == true)
{
e.print("<td><font color=green>aktiv</font></td>");
e.print("<td><A HREF='?cmd4=off'>Ausschalten</A></td>");
}
else
{
e.print("<td><font color=red>inaktiv</font></td>");
e.print("<td><A HREF='?cmd4=on'>Anschalten</A></td>");
}
*/
e.respond();
}
}
Sind nur Dose 1 und 2 im Script sprich ich kommentiere alles was Dose 3 und 4 betrifft aus funktioniert es super.
Kann es sein das das zuviel Code ist? Beim uploaden bekomme ich Binary sketch size: 5500 bytes (of a 14336 byte maximum)
Sollte also IO sein, ist ein selbstgelöteter Arduino mit einem Atmega 168
http://zyrusthc.homeip.net/fotoarchiv/displayimage.php?album=18&pid=434#top_display_media
http://zyrusthc.homeip.net/fotoarchiv/displayimage.php?album=18&pid=430#top_display_media
Wo kann ich den Fehler suchen oder woran liegt es das er nicht mehr als 2 Dosen schalten will?
Greeez Oli