Ok so i took a bit of a break from my project over christmas and thought i better finish it off but im having a bit of problem with some programming strangely enough being in the programming section!
I have used some code found on the forum to include my RTC clock DS3231, (not DS1307 as stated in my code but they work the same) the problem is im getting some "invalid conversion from 'int*' to 'uint8_t'" errors and wondered if someone could point me in the right direction? Many thanks
// Lilypad binary clock - Set using RTC
#include <Time.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library that returns time as a time_t
int hourLEDs[] = {1, 2, 3, 4}; // Hours LED (Digital Pin 1-4)
int minuteLEDs[] = {10, 9, 8, 7, 6, 5}; // Minutes Led (Digital Pin 10-5)
int secondLEDs[] = {16, 15, 14, 13, 12, 11}; // Seconds Led (Digital Pin 12-11 Analog Pin 2-0)
int loopLEDs[] = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // Spin Led In this order
int switchPin = 17 ; // Used for setting time, hold to advance. (to be used for interupt once RTC is avalible)
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);
}
time_t t = now();
setSyncProvider(RTC.get); // the function to get the time from the RTC
Serial.begin(9600);
}
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
}
else if (minute() == 0 && second() == 0)
{
spin(hour());
}
updateDisplay();
delay(1);
}
void updateDisplay()
{
setSyncProvider(RTC.get);
time_t t = now();
setOutput(hourLEDs, 4, hourFormat12(t));
setOutput(minuteLEDs, 6, minute(t));
setOutput(secondLEDs, 6, second(t));
Serial.print(hour());
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(50);
digitalWrite(loopLEDs[j], LOW);
}
}
}
Errors
round_Clock_v1_4.ino: In function 'void setup()':
round_Clock_v1_4:21: error: invalid conversion from 'int*' to 'uint8_t'
round_Clock_v1_4:21: error: initializing argument 1 of 'void pinMode(uint8_t, uint8_t)'
round_Clock_v1_4:25: error: invalid conversion from 'int*' to 'uint8_t'
round_Clock_v1_4:25: error: initializing argument 1 of 'void pinMode(uint8_t, uint8_t)'
round_Clock_v1_4:29: error: invalid conversion from 'int*' to 'uint8_t'
round_Clock_v1_4:29: error: initializing argument 1 of 'void pinMode(uint8_t, uint8_t)'
round_Clock_v1_4:32: error: 'RTC' was not declared in this scope
round_Clock_v1_4.ino: In function 'void loop()':
round_Clock_v1_4:43: error: 'RTC' was not declared in this scope
round_Clock_v1_4.ino: In function 'void updateDisplay()':
round_Clock_v1_4:57: error: 'RTC' was not declared in this scope
round_Clock_v1_4.ino: In function 'void setOutput(int*, int, int)':
round_Clock_v1_4:83: error: invalid conversion from 'int*' to 'uint8_t'
round_Clock_v1_4:83: error: initializing argument 1 of 'void digitalWrite(uint8_t, uint8_t)'