/Links/
DS1307new cpp file : Google Code Archive - Long-term storage for Google Code Project Hosting.
Bounce: Bounce Library, for Easily Reading Pushbuttons or Mechanical Sensors With Contacts That "Bounce"
/********************************************************************/
I am using the DS1307new library for keeping track of the time for a clock. I have not set the IC to the correct time yet (It is currently stuck on 2011
). Using the settime() function available with the library, I can do this. However:
// Set time to the RTC chip in BCD format
void DS1307new::setTime(void)
{
Wire.beginTransmission(DS1307_ID);
Wire.write((uint8_t)0x00);
Wire.write(dec2bcd(second) | 0x80); // set seconds (clock is stopped!)
Wire.write(dec2bcd(minute)); // set minutes
Wire.write(dec2bcd(hour) & 0x3f); // set hours (24h clock!)
Wire.write(dec2bcd(dow+1)); // set dow (Day Of Week), do conversion from internal to RTC format
Wire.write(dec2bcd(day)); // set day
Wire.write(dec2bcd(month)); // set month
Wire.write(dec2bcd(year-2000)); // set year
Wire.endTransmission();
}
This defines that the settime() function takes no arguments. And I don't see it taking data from the computer anywhere (.cpp link is above). How does it set the time?
The Bounce library provides a very clear description with it on how to use it. However I want to use about 5 or 6 buttons in a voltage divider circuit connected to only one analog pin (as my digital pins are already being used up quite a lot.)
I just want to prevent the buttons from bouncing using the library, the rest I will take care of according to my pullup resistor values. Do you think (or know) it will work?
Thanks in advance for all your trouble. Please properly read the .cpp file before answering. I request it. Thanks again!