Show Posts
Pages: [1]
1  Projects / Your Projects / Re: Post your ArduiNIX projects here, folks! on: August 28, 2013, 02:19:37 PM
Built a cabinet for my turntable, receiver, and records.

All I had to work with was a table saw at my parents, then the rest had to be done in my tiny apartment. I'm sure a few rough spots could have been made better but I'm happy with the outcome!
Used an arduinix setup and an RTC 1307 chip to keep the clock accurate even if I turn it off (i.e. to sleep). Used the sample 6 bulb code with some help from Risen's code.

http://imgur.com/a/ZXuTJ
2  Projects / ArduiNIX / Arduino code for converting RTC time to 12h on: August 26, 2013, 09:11:01 PM
So close to being done my build! The last step is to just convert the time from 24h to 12h format. I'm having problems here though. I pull the time from a breakaway RTC board, which comes back as the now variable. I then try to convert it from 24h to 12h as follows:

Code:
if (now.hour() > 12)
{
  long hours = now.hour()-12;
  Serial.print(now.hour(), DEC);
  Serial.print(hours);
}
else
{
  long hours = now.hour();
}

If I try compiling this code, it claims that the 'hours' variable is never established later
(when it is called for at:
int lowerHours = hours % 10;)

I tried putting in a dummy line of:
long hours = 0;
before the if statement just to get it established. This lets the code work and the serial.print output is showing that it's making the right calculation for the time, but the hour is always 0.
Any suggestions?

Figured it out. I needed to just do hours = inside the if after establishing it prior, not long hours =.
Pages: [1]