Binary Clock - Help again!

Okay, Ive been playing with the Evil Genius binary clock and I added a RTC to keep the time accurate.

Final problem is that the LED on lilypad pin 1 remains high. It does appear to flash off with the updateDisplay routine, but essentially it is on all the time.

I can see the time on the serial monitor and also advance the time, but it always remain on with some brief flashes off during uploading or as listed above.

Des anyone see something causing this?

#include <Time.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library that returns time as a time_t

int switchPin = 11;

int hourLEDs = {4, 3, 2, 1}; // least significant bit first
int secondLEDs = {10, 9, 8, 7, 6, 5};
int minuteLEDs = {17, 16, 15, 14, 13, 12};

int loopLEDs = {4, 3, 2, 1, 17, 16, 15, 14, 13, 12, 10, 9, 8, 7, 6, 5};

void setup()
{
for (int i = 0; i < 4; i++)
{
pinMode(hourLEDs*, OUTPUT);*

  • }*
  • for (int i = 0; i < 6; i++)*
  • {*
    _ pinMode(minuteLEDs*, OUTPUT);_
    _
    }_
    _
    for (int i = 0; i < 6; i++)_
    _
    {_
    _ pinMode(secondLEDs, OUTPUT);
    }*_

* Serial.begin(9600);*
* setSyncProvider(RTC.get); // the function to get the time from the RTC*
}
*void loop() *
{
* if (digitalRead(switchPin))*
* {*
* adjustTime(60-second()); // Move the clock forward to the next minute *
* RTC.set(now()); // Set the RTC to the new time*
* delay(100);*

* }*
* else if (minute() == 0 && second() == 0)*
* {*
* spin(hour());*
* }*
* updateDisplay();*
* delay(100);*

}
void updateDisplay()
{

* //setSyncProvider(RTC.get);*
* //time_t t = now();
_ setOutput(hourLEDs, 4, hourFormat12());
setOutput(minuteLEDs, 6, minute());
setOutput(secondLEDs, 6, second());*_

* Serial.print(hourFormat12());*
* printDigits(minute());*
* printDigits(second());*
* Serial.println();*
}
void printDigits(int digits){
* // utility function for digital clock display: prints preceding colon and leading 0*
* Serial.print(":");*
* if(digits < 10)*
* Serial.print(‘0’);*
* Serial.print(digits);*
}
void setOutput(int *ledArray, int numLEDs, int value)
{
* for (int i = 0; i < numLEDs; i++)*
* {*
_ digitalWrite(ledArray*, bitRead(value, i));
}
}
void spin(int count)
{
for (int i = 0; i < count; i++)
{
for (int j = 0; j < 16; j++)
{
digitalWrite(loopLEDs[j], HIGH);
delay(25);
digitalWrite(loopLEDs[j], LOW);
}
}*_

* setSyncProvider(RTC.get);*
}

Is pin 1 used for the serial port on the lilypad? might be seeing a conflict there -

Try putting your code inside a code block - the button with the “#”

The original code used the same pins and If I run that program it seems find, just does not use the RTC. (My original clock was running at 1/2 speed and I think the board was bad. Bought a new one and it appears much better. Just trying to add in the RTC to keep time accurate)

I added in the RTC and a print.serial so that I could see the time when plugged in. Now I can't seem to be able to get pin to go low.

I'm not sure what you mean by "Try putting your code inside a code block - the button with the "#"..... New to arduino and C :)

Thanks for looking, Dan

I'm not sure what you mean by "Try putting your code inside a code block - the button with the "#"..... New to arduino and C

Above the gray box where you type and paste code, there are a series of icons. One of them has a # sign on it. Press that BEFORE you paste code, and you will see [code][/code] with the cursor between the ] and the [. That is where you paste your code.

Thanks... Got it.

Found the problem (I think)

I turned off the serial display for "seeing" the time value. Appears to be working inf now! :)

danielNC: I turned off the serial display for "seeing" the time value. Appears to be working inf now! :)

This is what kf2qd was getting at. You are using Pin 1 in your code, so of course it will react when Serial communication occurs.