Programing

Ref: Arduino Cookbook, Michael Margolis, first edition.

I copied the Recipe , 12.4 Using Arduino As a Clock shown below,

When compiling, I got the error report shown at the end.
Prior to trying to compile, I downloaded the # include <Time.h> , unzipped it and copied it to the sketch library. It then automatically inserted those #include items it at the top of the sketch.

QUESTIONS:

  1. What do the error codes mean?
  2. How do I correct the sketch?
  3. How are lines numbered?

#include <Time.h>

#include <ArduinoTestSuite.h>
#include <avr_cpunames.h>

// TIME SKETCH

void setup(){ Serial.begin(9600);
setTime ( 12,0,0,1,1,11); //set time to noon Jan 1, 2011
}
Void loop()
{
digitalClockDisplay();
delay (1000);//1000 milliseconds = 1 second
}
void digitalClockDisplay();
{
//digital clock display of time
Serial.print (hour());
printDigits(minute());
printDigits(second());
Serial.print (" “);
Serial.print (day());
Serial.print (” “);
Serial.print (month());
Serial.print (” “);
Serial.print (year());
Serial.println ();
}
void printDigits(int digits){
// utility function for clock display: prints preceding colon and leading 0
Serial.print (”:");
if (digits < 10)Serial. print(‘0’);
Serial.print (digits);
}

=========================================
ERRORS LISTED BY COMPILER
Time_Demo_sketch_oct01a: 7: error: ‘Void’ does not name a type
Time_Demo_sketch_oct01a: 11: error: ‘Void’ does not name a type
Time_Demo_sketch_oct01a: 17:error: expected unqualified-id before ‘{‘ token

1) What do the error codes mean?

This one:

Time_Demo_sketch_oct01a: 7: error: ‘Void’ does not name a type

is pretty obvious. Void does not name a type. void does. Case matters.

2) How do I correct the sketch?

Spell things correctly.

3) How are lines numbered?

The usual way - 1, 2, 3...

The line number that is shown in the error message may not correspond to the exact line that the error occurred on, but they will be close.

Your clock is going to lose time badly because serial comms are slow, and take time, so you delay(1000) will add to the time taken by the serial prints Using millis is preferable.

(deleted)