my lcd loop commands dont work!!! help asap guys i tried everything i can

#include <LiquidCrystal.h>
#include “Wire.h”
#include <VirtualWire.h>
#include <VirtualWire_Config.h>
#include “RTClib.h”
RTC_DS1307 RTC;
#define DS1307_ADDRESS 0x068
LiquidCrystal lcd(12,11,5,4,3,2);
byte zero = 0x00; //workaround for issue #527
const int button1=9;
const int button2=8;
/const int button3=7;/
int seconds;
int button1state=0;
int prevbutton1state=0;
int button2state=0;
int prevbutton2state=0;
int button3state=0;
int prevbutton3state=0;
int Smodeenabled=0;
int Mmodeenabled=0;
int veille=0;

void setup(){
Serial.begin(9600);
lcd.begin(16,2);
Wire.begin();
RTC.begin();
RTC.adjust(DateTime(DATE, TIME));
setDateTime(); //MUST CONFIGURE IN FUNCTION
Serial.println(“Interfacing RF 433Mhz with Arduino”);
lcd.setCursor(0,1);
lcd.print(“smartmode:”);
lcd.home();
lcd.blink();
vw_set_ptt_inverted(true);
vw_setup(2000);
pinMode(button1,INPUT);
pinMode(button2,INPUT);

/*pinMode(button3,INPUT); */
}

void loop(){
DateTime now = RTC.now();
printDate();
delay(500);
button1state=digitalRead(button1);
delay(1);
button2state=digitalRead(button2);
delay(1);
/button3state=digitalRead(button3);/
if(button1state != prevbutton1state){
if(button1state==HIGH){
Smodeenabled = !Smodeenabled;}}
/if(button3state !=prevbutton3state){
if(button3state==HIGH){
veille = !veille;}}
if (veille ==1){
lcd.display();}
else {
lcd.noDisplay();}
/

if(button2state==HIGH){
/* second_screen();*/
delay(1000);}
prevbutton1state=button1state;

}

void setDateTime(){
DateTime now = RTC.now();
byte second = now.second(); //0-59
byte minute = now.minute(); //0-59
byte hour = now.hour(); //0-23
byte weekDay = 5; //1-7
byte monthDay = now.day(); //1-31
byte month = now.month(); //1-12
byte year = 15; //0-99
if (weekDay==7){
weekDay==0;
weekDay++;
}

Wire.beginTransmission(DS1307_ADDRESS);
Wire.write(zero); //stop Oscillator

Wire.write(decToBcd(second));
Wire.write(decToBcd(minute));
Wire.write(decToBcd(hour));
Wire.write(decToBcd(weekDay));
Wire.write(decToBcd(monthDay));
Wire.write(decToBcd(month));
Wire.write(decToBcd(year));

Wire.write(zero); //start

Wire.endTransmission();

}

byte decToBcd(byte val){
// Convert normal decimal numbers to binary coded decimal
return ( (val/10*16) + (val%10) );
}

byte bcdToDec(byte val) {
// Convert binary coded decimal to normal decimal numbers
return ( (val/16*10) + (val%16) );
}

void printDate(){

// Reset the register pointer
Wire.beginTransmission(DS1307_ADDRESS);
Wire.write(zero);
Wire.endTransmission();

Wire.requestFrom(DS1307_ADDRESS, 7);

int second = bcdToDec(Wire.read());
int minute = bcdToDec(Wire.read());
int hour = bcdToDec(Wire.read() & 0b111111); //24 hour time
int weekDay = bcdToDec(Wire.read()); //0-6 → sunday - Saturday
int monthDay = bcdToDec(Wire.read());
int month = bcdToDec(Wire.read());
int year = bcdToDec(Wire.read());
//print the date EG 3/1/11 23:59:59

/* switch(weekDay){
case 0:
lcd.print(“Dimanche”);
break;
case 1:
lcd.print(“Lundi”);
break;
case 2:
lcd.print(“Mardi”);
break;
case 3:
lcd.print(“Mercredi”);
break;
case 4:
lcd.print(“Jeudi”);
break;
case 5:
lcd.print(“Vendredi”);
break;
case 6:
lcd.print(“Samedi”);
break;}
lcd.print(" “);
lcd.print(“le”);
lcd.print(” ");*/
lcd.home();

lcd.print(monthDay);
lcd.print("/");
lcd.print(month);
lcd.print("/");
lcd.print(“20”);
lcd.print(year);
lcd.print(" “);
lcd.print(hour);
lcd.print(”:");
lcd.print(minute);
lcd.print(":");
lcd.print(second);
delay(250);
lcd.setCursor(11,1);
if(Smodeenabled==0){
Serial.println(“0”);
delay(10);
lcd.print(“off”);
delay(10);}
else {
Serial.println(“1”);
lcd.print(“on”);
delay(250);
smartmode();}

}
//smart mode config
void smartmode(){
int second = bcdToDec(Wire.read());
int minute = bcdToDec(Wire.read());
int hour = bcdToDec(Wire.read() & 0b111111); //24 hour time
int weekDay = bcdToDec(Wire.read()); //0-6 → sunday - Saturday
int monthDay = bcdToDec(Wire.read());
int month = bcdToDec(Wire.read());
int year = bcdToDec(Wire.read());
if(weekDay=0){}
else if(weekDay<5){
if(hour==7 && minute==55 && second>=00 && second<=2 ){
send_the_go();}
if(hour==8 && minute==55 && second>=00 && second<=2){
send_the_go(); }
if(hour==9 && minute==55 && second>=00 && second<=2){
send_the_go();}
if(hour==10 && minute==05 && second>=00 && second<=2){
send_the_go(); }
if(hour==11 && minute==00 && second>=00 && second<=2){
send_the_go(); }
if(hour==12 && minute==00&& second>=00 && second<=2){
send_the_go(); }
if(hour==13 && minute==55 && second>=00 && second<=2){
send_the_go(); }
if(hour==14 && minute==55 && second>=00 && second<=2){
send_the_go(); }
if(hour==15 && minute==55 && second>=00 && second<=2){
send_the_go(); }
if(hour==16 && minute==05 && second>=00 && second<=2){
send_the_go(); }
if(hour==17 && minute==00 && second>=00 && second<=2){
send_the_go(); }
if(hour==18 && minute==00 && second>=00 && second<=2){
send_the_go();}}
else {
if(hour==8 && minute==55 && second>=00 && second<=2){
send_the_go();}
if(hour==9 && minute==55 && second>=00 && second<=2){
send_the_go(); }
if(hour==10 && minute==05 && second>=00 && second<=2){
send_the_go(); }
if(hour==11 && minute==00 && second>=00 && second<=2){
send_the_go(); }
if(hour==12 && minute==00&& second>=00 && second<=2){
send_the_go(); }}}
//the manual mode
void manualmode(){
send_the_go();
}
//wireless connection
void send_the_go (){
const char *msg = "I m Arduino ";
digitalWrite(13, true);
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx();
Serial.println("The Message is Successfully Sent! ");
digitalWrite(13,false);
delay(1000);}

void second_screen(){
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“sonnerie”);
lcd.setCursor(1,1);
lcd.print(“actif”);
send_the_go();}

Hi,
Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

If your sketch is too big, use REPLY rather than QUICK REPLY and it has an attachment facility, so you can post your sketch as an attachment, but try code tags first.

By doing this it will make it easier to read.

What do you mean by loop commands don’t work, what is the sketch supposed to do, what arduino controller do you have and what other things attached to it.

Thanks…Tom… :slight_smile:

Tried everything? Have u tried just getting the LCD to work on its own....? Try getting it to work with a basic example sketch in the library. From there you should be able integrate it into your project sketch.

You should also post a link to your LCD, so anyone trying to help you knows what hardware they are dealing with.

hi i am not very at english but i will try to explain my lcd does not pront any variable and i am using an arduino uno r3 attched with a transmitter and an rtc three buttons and of course the lcd i tried so hard and it was suppose to be a bell for shool that works automatically :/

aisc: Tried everything? Have u tried just getting the LCD to work on its own....? Try getting it to work with a basic example sketch in the library. From there you should be able integrate it into your project sketch.

You should also post a link to your LCD, so anyone trying to help you knows what hardware they are dealing with.

yes i very much tried that and it works fine i need some help my dead line is getting closer

#include <LiquidCrystal.h>
#include "Wire.h"
#include <VirtualWire.h>
#include <VirtualWire_Config.h>
#include "RTClib.h"
RTC_DS1307 RTC;
#define DS1307_ADDRESS 0x068
LiquidCrystal lcd(12,11,5,4,3,2);
byte zero = 0x00; //workaround for issue #527
const int button1=9;
const int button2=8;
/*const int button3=7;*/
int seconds;
int button1state=0;
int prevbutton1state=0;
int button2state=0;
int prevbutton2state=0;
int button3state=0;
int prevbutton3state=0;
int Smodeenabled=0;
int Mmodeenabled=0;
int veille=0;

void setup(){
   Serial.begin(9600);
  lcd.begin(16,2);
  Wire.begin();
  RTC.begin();
  RTC.adjust(DateTime(__DATE__, __TIME__));
  setDateTime(); //MUST CONFIGURE IN FUNCTION
  Serial.println("Interfacing RF 433Mhz with Arduino");
  lcd.setCursor(0,1);
  lcd.print("smartmode:");
  lcd.home();
  lcd.blink();
 vw_set_ptt_inverted(true); 
 vw_setup(2000);
  pinMode(button1,INPUT);
  pinMode(button2,INPUT);
  
  /*pinMode(button3,INPUT); */
}

void loop(){
  DateTime now = RTC.now();
   printDate(); 
   delay(500);
 button1state=digitalRead(button1);
 delay(1);
 button2state=digitalRead(button2);
 delay(1);
 /*button3state=digitalRead(button3);*/
 if(button1state != prevbutton1state){
  if(button1state==HIGH){
  Smodeenabled = !Smodeenabled;}}
  /*if(button3state !=prevbutton3state){
    if(button3state==HIGH){
      veille = !veille;}}
 if (veille ==1){
  lcd.display();}
  else {
    lcd.noDisplay();}*/
    
  if(button2state==HIGH){
   /* second_screen();*/
  delay(1000);}
 prevbutton1state=button1state; 

  }

void setDateTime(){
  DateTime now = RTC.now();
  byte second =   now.second(); //0-59
  byte minute =    now.minute(); //0-59
  byte hour =      now.hour(); //0-23
  byte weekDay =     5; //1-7
  byte monthDay =  now.day(); //1-31
  byte month =      now.month(); //1-12
  byte year  =      15; //0-99
  if (weekDay==7){
    weekDay==0;
    weekDay++;
  }

  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(zero); //stop Oscillator

  Wire.write(decToBcd(second));
  Wire.write(decToBcd(minute));
  Wire.write(decToBcd(hour));
  Wire.write(decToBcd(weekDay));
  Wire.write(decToBcd(monthDay));
  Wire.write(decToBcd(month));
  Wire.write(decToBcd(year));

  Wire.write(zero); //start 

  Wire.endTransmission();

}

byte decToBcd(byte val){
// Convert normal decimal numbers to binary coded decimal
  return ( (val/10*16) + (val%10) );
}

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
  return ( (val/16*10) + (val%16) );
}

void printDate(){

  // Reset the register pointer
  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(zero);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_ADDRESS, 7);

  int second = bcdToDec(Wire.read());
  int minute = bcdToDec(Wire.read());
  int hour = bcdToDec(Wire.read() & 0b111111); //24 hour time
  int weekDay = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  int monthDay = bcdToDec(Wire.read());
  int month = bcdToDec(Wire.read());
  int year = bcdToDec(Wire.read());
  //print the date EG   3/1/11 23:59:59
 
 /* switch(weekDay){
  case 0:
  lcd.print("Dimanche");
  break;
  case 1:
  lcd.print("Lundi");
  break;
  case 2:
  lcd.print("Mardi");
  break;
  case 3:
  lcd.print("Mercredi");
  break;
  case 4:
  lcd.print("Jeudi");
  break;
  case 5:
  lcd.print("Vendredi");
  break;
  case 6:
  lcd.print("Samedi");
  break;}
  lcd.print(" ");
  lcd.print("le");
  lcd.print(" ");*/
  lcd.home();

  lcd.print(monthDay);
  lcd.print("/");
  lcd.print(month);
  lcd.print("/");
  lcd.print("20");
  lcd.print(year);
  lcd.print(" ");
  lcd.print(hour);
  lcd.print(":");
  lcd.print(minute);
  lcd.print(":");
  lcd.print(second);
  delay(250);
  lcd.setCursor(11,1);
  if(Smodeenabled==0){
    Serial.println("0");     
    delay(10);
    lcd.print("off");
    delay(10);}
  else {
    Serial.println("1");
    lcd.print("on");
    delay(250);
    smartmode();}
  
  }
//smart mode config 
void smartmode(){
  int second = bcdToDec(Wire.read());
  int minute = bcdToDec(Wire.read());
  int hour = bcdToDec(Wire.read() & 0b111111); //24 hour time
  int weekDay = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  int monthDay = bcdToDec(Wire.read());
  int month = bcdToDec(Wire.read());
  int year = bcdToDec(Wire.read());
  if(weekDay=0){}
  else if(weekDay<5){
if(hour==7 && minute==55 && second>=00 && second<=2 ){
    send_the_go();}  
 if(hour==8 && minute==55 &&  second>=00 && second<=2){
    send_the_go(); }
 if(hour==9 && minute==55 &&  second>=00 && second<=2){
    send_the_go();}
 if(hour==10 && minute==05 &&  second>=00 && second<=2){
    send_the_go();   }
 if(hour==11 && minute==00 &&  second>=00 && second<=2){
    send_the_go();       }
 if(hour==12 && minute==00&&  second>=00 && second<=2){
    send_the_go();     }
 if(hour==13 && minute==55 &&  second>=00 && second<=2){
    send_the_go();  }
 if(hour==14 && minute==55 &&  second>=00 && second<=2){
    send_the_go();    }
 if(hour==15 && minute==55 &&  second>=00 && second<=2){
    send_the_go();    }
 if(hour==16 && minute==05 &&  second>=00 && second<=2){
    send_the_go();        }
 if(hour==17 && minute==00 &&  second>=00 && second<=2){
    send_the_go();      }
 if(hour==18 && minute==00 &&  second>=00 && second<=2){
    send_the_go();}}
  else {
 if(hour==8 && minute==55 &&  second>=00 && second<=2){
     send_the_go();}
 if(hour==9 && minute==55 &&  second>=00 && second<=2){
    send_the_go(); }
    if(hour==10 && minute==05 &&  second>=00 && second<=2){
     send_the_go(); }
    if(hour==11 && minute==00 &&  second>=00 && second<=2){
    send_the_go();   }
    if(hour==12 && minute==00&&  second>=00 && second<=2){
     send_the_go();  }}}
//the manual mode
void manualmode(){
  send_the_go();
}
//wireless connection
void send_the_go (){
   const char *msg = "I m Arduino ";
   digitalWrite(13, true); 
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx();
    Serial.println("The Message is Successfully Sent! ");
    digitalWrite(13,false);
    delay(1000);}

   
  
  

void second_screen(){
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("****sonnerie****");
    lcd.setCursor(1,1);
    lcd.print("*****actif*****");
   send_the_go();}

Does this line of code print to the LCD?

lcd.print("smartmode:");

Yes or no?

aisc: Does this line of code print to the LCD?

lcd.print("smartmode:");

Yes or no?

yes unfortunately :(

modamine: yes unfortunately :(

Why unfortunately? Since English in not your first language - I am not sure what your response REALLY means.

So let's try again - reply with one of the following ways...

  1. Yes, it does print.
  2. No, it does not print.

aisc: Why unfortunately? Since English in not your first language - I am not sure what your response REALLY means.

So let's try again - reply with one of the following ways...

  1. Yes, it does print.
  2. No, it does not print.

hahaha ok yes it does print

Ok now your code has many parts which are commented out. You also have a "veille" variable which I assume is to mask printing - which is commented out.

Quote for me the code (and line number) which is the first print instruction that does NOT print? You must base it on the exact code you posted or we will be speaking different languages.

seinsei if i can call you that i figured it out it works but thnx a lot seinsei :p

Ok Grasshopper - I am pleased u resolved the problem :)

Hi, What was the problem and how did you fix it, This thread will be used to help other users that may have problems too. So please tell us what it was.

Tom.... :)