   // Update the LCD with the reading
   cout << clear;
 
-  // First line with date and temperature
+  // First line with date and temperature. Use BCD format output
   cout << PSTR("20") << bcd << now.year << '-'
        << bcd << now.month << '-'
-       << bcd << now.date << PSTR("  ")
+       << bcd << now.date << ' '
        << (temp >> 2) << PSTR(" C");
 
   // Second line with time and battery status

#include "Cosa/LCD/Driver/HD44780.hh"
#include "Cosa/TWI/Driver/DS3231.hh"

// Remove comment to set real-time clock (update below)
// #define RTC_SET_TIME
DS3231 rtc;

// Select the access port for the LCD
// HD44780::Port4b port;
// HD44780::SR3W port;
// HD44780::SR3WSPI port;
// HD44780::SR4W port;
// HD44780::ERM1602_5 port;
// HD44780::MJKDZ port;
HD44780::GYIICLCD port;
// HD44780::DFRobot port;
HD44780 lcd(&port);
IOStream cout(&lcd);

void setup()

  now.year = 0x13;
  rtc.set_time(now);
#endif

#if defined(__ARDUINO_MEGA__)
  // Start the accelerometer with the default settings
  accelerometer.begin();

  // Set continous measurement mode, 3 Hz output, avg 8 samples, +-4.0 Gauss
  compass.set_output_rate(HMC5883L::OUTPUT_RATE_3_HZ);
  compass.set_samples_avg(HMC5883L::SAMPLES_AVG_8);
  compass.set_range(HMC5883L::RANGE_4_0_GA);
  compass.set_mode(HMC5883L::CONTINOUS_MEASUREMENT_MODE);

  // And start the compass
  compass.begin();
#endif

  // Give the sensors some time for startup
  SLEEP(1);
}

void loop()
