Hello,
sorry for probably a very beginner question lol. but i am trying to learn here so forgive me:)
so already thank you! if there is a information missing please let me know.
i was trying to program the DS3231 RTC time clock. i started with the arduino uno and uploaded my sketch for the RTC. i did that with the web creator. and had no problem.
because of a issue with my computer i am uploading a sketch now to a arduino mega via my raspberry pi 4. i downloaded the new verion from the arduino ide from the arduino page. the example sketches work fine. also rfid project and so on i did were ok. but the RTC won t work . it always shows me an error at the struct ts t;
i got that project from this page.
i downloaded the libary from the page where they used the matching code. that code i used before like i said on the web creator and it worked fine. but when i do it with the raspberry it shows me this error. The code i will put on the bottom.
ERROR CODE
Arduino: 1.8.13 (Linux), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
mega_rfid:4:11: error: aggregate 'ts t' has incomplete type and cannot be defined
struct ts t;
THIS IS THE CODE I USE
[color=#444444][color=#95a5a6]#include <Wire.h>[/color]
[color=#95a5a6]#include <ds3231.h>[/color]
struct ts t;
void setup[color=#434f54]()[/color] [color=#434f54]{[/color]
Serial.begin[color=#434f54]([/color][color=#434f54]9600[/color][color=#434f54])[/color];
Wire.begin[color=#434f54]()[/color];
DS3231_init[color=#434f54]([/color]DS3231_INTCN[color=#434f54])[/color];
/*----------------------------------------------------------------------------
In order to synchronise your clock module, insert timetable values below !
----------------------------------------------------------------------------*/
t.hour[color=#434f54]=[/color][color=#434f54]12[/color];
t.min[color=#434f54]=[/color][color=#434f54]30[/color];
t.sec[color=#434f54]=[/color][color=#434f54]0[/color];
t.mday[color=#434f54]=[/color][color=#434f54]25[/color];
t.mon[color=#434f54]=[/color][color=#434f54]12[/color];
t.year[color=#434f54]=[/color][color=#434f54]2019[/color];
DS3231_set[color=#434f54]([/color]t[color=#434f54])[/color];
[color=#434f54]}[/color]
void loop[color=#434f54]()[/color] [color=#434f54]{[/color]
DS3231_get[color=#434f54]([/color]&t[color=#434f54])[/color];
Serial.print[color=#434f54]([/color][color=#7f8c8d]"Date : "[/color][color=#434f54])[/color];
Serial.print[color=#434f54]([/color]t.mday[color=#434f54])[/color];
Serial.print[color=#434f54]([/color][color=#7f8c8d]"/"[/color][color=#434f54])[/color];
Serial.print[color=#434f54]([/color]t.mon[color=#434f54])[/color];
Serial.print[color=#434f54]([/color][color=#7f8c8d]"/"[/color][color=#434f54])[/color];
Serial.print[color=#434f54]([/color]t.year[color=#434f54])[/color];
Serial.print[color=#434f54]([/color][color=#7f8c8d]"\t Hour : "[/color][color=#434f54])[/color];
Serial.print[color=#434f54]([/color]t.hour[color=#434f54])[/color];
Serial.print[color=#434f54]([/color][color=#7f8c8d]":"[/color][color=#434f54])[/color];
Serial.print[color=#434f54]([/color]t.min[color=#434f54])[/color];
Serial.print[color=#434f54]([/color][color=#7f8c8d]"."[/color][color=#434f54])[/color];
Serial.println[color=#434f54]([/color]t.sec[color=#434f54])[/color];
delay[color=#434f54]([/color][color=#434f54]1000[/color][color=#434f54])[/color];
[color=#434f54]}[/color][/color]