Hi,
I'm trying to create a digital clock simulated in the Virtual BreadBoard Environment.
I have found a few approaches and I think this one should work that I have typed up but I'm getting error messages that make no sense.
If anyone has had any experience with VBB and has anything to say about that please let me know.
But here's what I have and should this code work?
/*
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
*/
#include <LiquidCrystal.h>
#include <DateTime.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 2, 3, 4, 5) ;
void setup() {
//Set time
DateTime.sync(123076800);
}
void loop() {
if(DateTime.available()){
unsigned long prevtime;
prevtime = DateTime.now(); im getting and error here saying DateTime not definied in current context
while( prevtime == DateTime.now());
DateTime.available();
digitalClockDisplay();
}
} this line saying i need a semi colon
void printDigits(byte digits){
lcd.print(":");
if(digits < 10) lcd.print('0');
lcd.print(digits, DEC);
}
void digitalClockDisplay(){
lcd.home();
lcd.print(DateTime.Hour, DEC); Then this and the following two lines saying cannot resolve
printDigits(DateTime.Minute); DateTime.XXXX
printDigits(DateTime.Second);
}
Is my code correct? This is the first time I'm using VBB or Arduino.
I have come across some other ways to do it.
Would trying to use the Time library be a better idea and if so could someone help me in the right direction?
Thanks!