when i added the transmissopn library (virtual wirel.h) and the transmission settings my screen went empty and when i removed all the settings i got my display back can anyone help ??
You can use the 2 together.
I am doing so.
Nobody can help you if you don't post information.
You could be using conflicting libraries fighting for the same resources.
I suggest you do the following...
Take a basic example from the Virtualwire library and from the LCD library.
Combine the 2 sketches.
Get that to work then add it to your project sketch.
#include <VirtualWire.h>
#include <VirtualWire_Config.h>
#include <LiquidCrystal.h>
#include <Wire.h>
#include <RTClib.h>
RTC_DS1307 RTC;
LiquidCrystal lcd(13,11,5,4,3,2);
byte zero = 0x00;
int button1=9;
int button2=8;
int button3=7;
int button1state=0;
int button2state=0;
int button3state=0;
int prevbutton1state=0;
int prevbutton3state=0;
int Smodeenabled=0;
int Vmode=0;
void setup () {
Serial.begin(9600);
Wire.begin();
RTC.begin();
lcd.begin(16,2);
pinMode(button1,INPUT);
pinMode(button3,INPUT);
pinMode(button3,INPUT);
// following line sets the RTC to the date & time this sketch was compiled
//RTC.adjust(DateTime(__DATE__, __TIME__));
}
void loop () {
DateTime now = RTC.now();
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){
Vmode=!Vmode;}}
/*if(Vmode=0){
lcd.display();}
else{
lcd.noDisplay();}*/
print_date();
if(button2state==HIGH){
send_the_go();
}
prevbutton3state=button3state;
prevbutton1state=button1state;}
void smartmode(){
DateTime now = RTC.now();
if(now.dayOfWeek()==0){}
else if(now.dayOfWeek()<5){
if(now.hour()==7 && now.minute()==55 && now.second()>=00 && now.second()<=2 ){
send_the_go();}
if(now.hour()==8 && now.minute()==55 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==9 && now.minute()==55 && now.second()>=00 && now.second()<=2){
send_the_go();}
if(now.hour()==10 && now.minute()==05 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==11 && now.minute()==00 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==12 && now.minute()==00&& now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==13 && now.minute()==55 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==14 && now.minute()==55 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==15 && now.minute()==55 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==16 && now.minute()==05 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==17 && now.minute()==00 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==18 && now.minute()==00 && now.second()>=00 && now.second()<=2){
send_the_go();}}
else {
if(now.hour()==8 && now.minute()==55 && now.second()>=00 && now.second()<=2){
send_the_go();}
if(now.hour()==9 && now.minute()==55 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==10 && now.minute()==05 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==11 && now.minute()==00 && now.second()>=00 && now.second()<=2){
send_the_go(); }
if(now.hour()==12 && now.minute()==00&& now.second()>=00 && now.second()<=2){
send_the_go(); }}}
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 print_date(){
DateTime now = RTC.now();
lcd.clear();
lcd.setCursor(0,1);
lcd.print("mode auto:");
lcd.home();
lcd.print(now.year(), DEC);
lcd.print('/');
lcd.print(now.month(), DEC);
lcd.print('/');
lcd.print(now.day(), DEC);
lcd.print(' ');
lcd.print(now.hour(), DEC);
lcd.print(':');
lcd.print(now.minute(), DEC);
lcd.setCursor(11,1);
if(Smodeenabled==0){
Serial.println("0");
delay(10);
lcd.print("off");
delay(10);}
else {
Serial.println("1");
lcd.print(" ");
lcd.setCursor(11,1);
lcd.print("on");
delay(250);
lcd.noAutoscroll();
smartmode();}
}
void second_screen(){
lcd.clear();
lcd.setCursor(0,0);
lcd.print("****sonnerie****");
lcd.setCursor(1,1);
lcd.print("*****actif*****");}
and when i add this line
vw_set_ptt_inverted(true);
vw_setup(2000);
booooooooom i lost all the display can someone help
Why do you need VirtualWire, instead of only the Wire library?
In
LiquidCrystal lcd(13,11,5,4,3,2);
you can configure which pins are used by the LCD, in case some other library also uses the given default pins.
i need virtual wire for the rf433 do you have any subbtitute code for the rf ???
I believe your problem is conflicting libraries.
You did not take my advise of creating a test script - ce la vie.
There are alternative RF libraries. I use Virtualwire, RCSwitch and RH_ASK.
However, I think you will find u need to change the LCD library.
Try the Francisco Malpartida library, it is what I use with Virtualwire.
Do a search on Github for it.
Again I advise, start with a simple sketch and see what works, then introduce it to your project sketch.
thx anyway i figured out i had a conflict in pins i fixed it thx anyway appreciated your help
hey can i use this piece of code to set aveille screen
if(Vmode=0){
lcd.display();}
else{
lcd.noDisplay();}
This is incorrect : if(Vmode=0)
It depends on what you want to achieve with the veil.
You need to specify exactly what you are trying to do.
But if u don't want to display anything at all, why initialise the LCD to start with?
if(Vmode=0) is never correct. = is assignment, == is comparison. if(Vmode==0) is potentially what you want.