Hi good night people,
I have a problem with my sketch and my LCD, if i put this two lines the information after this is not displayed, only before start the ethernet communication for example "proyecto" and "dimmer for bulb" its showed but the next strings are not displayed after the delay what im doing wrong?.
Thanks.
Ethernet.begin(mac, ip);
server.begin();
#include <LiquidCrystal.h>
#include <TimerOne.h>
#include <SPI.h>
#include <EthernetV2_0.h>
#define W5200_CS 10
#define SDCARD_CS 4
LiquidCrystal lcd(13,12,11,10,9,8);
volatile int i=0; // Variable to use as a counter
volatile boolean zero_cross=0; // Boolean to store a "switch" to tell us if we have crossed zero
int AC_pin = 3; // Output to Opto Triac
int dim2 = 0; // led control
int dim = 128; // Dimming level (0-128) 0 = on, 128 = 0ff
int pas = 8; // step for count;
int freqStep = 75; // This is the delay-per-brightness step in microseconds.
String readString = String(30); // tamaño de string para buscar las direcciones establecidas(Ligarled,Desligarled)
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // Escribimos la direccion MAC de el Ethernet Shield
byte ip[] = { 192, 168, 1, 2 }; // Escribimos la IP dentro del rango de la red
EthernetServer server(80); // Iniciamos el puerto de servicio
void setup() { // Begin setup
Serial.begin(9600);
pinMode(AC_pin, OUTPUT); // Set the Triac pin as output
digitalWrite(SDCARD_CS,HIGH);//Deselect the SD card
pinMode(SDCARD_CS,OUTPUT);
attachInterrupt(0, zero_cross_detect, RISING); // Attach an Interupt to Pin 2 (interupt 0) for Zero Cross Detection
Timer1.initialize(freqStep); // Initialize TimerOne library for the freq we need
Timer1.attachInterrupt(dim_check, freqStep); // Use the TimerOne Library to attach an interrupt
lcd.begin(16, 2); // set up the LCD's number of columns and rows:
lcd.clear(); // clear the screen
lcd.setCursor(2, 0); // put cursor at colon 0 and row 0
lcd.print("Proyecto"); // print a text
lcd.setCursor(0, 1); // put cursor at colon 0 and row 1
lcd.print("dimmer for bulb"); // print a text
delay (4000);
lcd.clear(); // clear the screen
Ethernet.begin(mac, ip);
server.begin();
}
void zero_cross_detect() {
zero_cross = true; // set the boolean to true to tell our dimming function that a zero cross has occured
i=0;
digitalWrite(AC_pin, LOW);
}
// Turn on the TRIAC at the appropriate time
void dim_check() {
if(zero_cross == true) {
if(i>=dim) {
digitalWrite(AC_pin, HIGH); // turn on light
i=0; // reset time step counter
zero_cross=false; // reset zero cross detection
}
else {
i++; // increment time step counter
}
}
}
void loop() {
Serial.print("dim=");
Serial.print(dim);
Serial.print(" dim2=");
Serial.print(dim2);
Serial.print(" dim1=");
Serial.print(2*dim);
Serial.print('\n');
delay (100);
lcd.setCursor(2, 0); // put cursor at colon 0 and row 0
lcd.print("power is "); // print a text
lcd.print(100-100*(255-dim2)/255);
lcd.print("% "); // print a text
lcd.setCursor(1, 1); // put cursor at colon 0 and row 1
lcd.print("dim. level="); // print a text
lcd.print(dim);
lcd.print(" "); // print a text
}