I have bought an Arduino mkr 1010 wifi and would like to use the code that I used for the Arduino UNO that worked but it does not work in the Arduino mkr 1010. I used exemples->rtclib-ds3131 instead and then I get the correct time but when I use the code that I used for Arduino UNO I get the following error code
In file included from C:\Users\ulfer\OneDrive\Dokument\Arduino\Arduinows2812DS3231hourminencolorny\Arduinows2812DS3231hourminencolorny.ino:1:0:
c:\Users\ulfer\OneDrive\Dokument\Arduino\libraries\DS3231/DS3231.h:120:3: error: 'Twi' does not name a type
Twi *twi;
^~~
exit status 1
Compilation error: exit status 1
I want to use this code:
#include <DS3231.h>
#include <FastLED.h>
#define NUM_LEDS 300
#define DATA_PIN 8
#define COLOR_ORDER GRB
#define CHIPSET WS2812B
#define BRIGHTNESS 40
#define VOLTS 5
#define MAX_AMPS 500
CRGB leds[NUM_LEDS];
int Relay = 4;
DS3231 rtc(SDA, SCL);
Time t;
const int OnHour = 5;
const int OnMin = 30;
const int OffHour = 8;
const int OffMin = 1;
const int OnHour2 = 17;
const int OnMin2 = 1;
const int OffHour2 = 23;
const int OffMin2 = 55;
void setup() {
Serial.begin(115200);
rtc.begin();
pinMode(Relay, OUTPUT);
digitalWrite(Relay, LOW);
FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS, MAX_AMPS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show();
}
void loop() {
t = rtc.getTime();
Serial.print(t.hour);
Serial.print(" hour(s), ");
Serial.print(t.min);
Serial.print(" minute(s)");
Serial.println(" ");
delay(1000);
if ((t.hour >= OnHour && t.min >= OnMin) && (t.hour <= OffHour && t.min <= OffMin) || (t.hour >= OnHour2 && t.min >= OnMin2) && (t.hour <= OffHour2 && t.min <= OffMin2)) {
digitalWrite(Relay, HIGH);
Serial.println("LIGHT ON");
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB::White;
FastLED.show();
delay(50);
}
} else {
digitalWrite(Relay, LOW);
Serial.println("LIGHT OFF");
}
}