#define LED_NUM 60
#include "FastLED.h"
#include "microDS3231.h"
#include "GyverTM1637.h"
GyverTM1637 disp(10, 9);
MicroDS3231 rtc;
CRGB leds[LED_NUM];
bool FLAG = false;
int BRIGHT = 10;
int LAST = 0;
String alarm = "15 45";
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
disp.clear(); // очистить
disp.brightness(4);
Serial.println(COMPILE_TIME);
rtc.setTime(COMPILE_TIME);
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, LED_NUM);
FastLED.setBrightness(100);
Serial.println("efdes");
FastLED.showColor(CRGB::Blue);
disp.point(1);
}
void loop() {
// put your main code here, to run repeatedly:
disp.displayClock(rtc.getHours(), rtc.getMinutes());
if (alarm==String(rtc.getHours())+" "+ String(rtc.getMinutes())){
FLAG=true;
LAST = alarm;
}
if(FLAG && LAST != String(rtc.getHours())+" "+ String(rtc.getMinutes())){
BRIGHT = BRIGHT+21;
LAST = String(rtc.getHours())+" "+ String(rtc.getMinutes());
if (BRIGHT==252){
FLAG=false;
}
}
delay(2000);
}
Код для адресной ленты будильника
Ошибка
C:\Users\admin\Documents\Arduino\led2\led2.ino: In function ‘void loop()’:
C:\Users\admin\Documents\Arduino\led2\led2.ino:42:63: error: cannot convert ‘StringSumHelper’ to ‘int’ in assignment
LAST = String(rtc.getHours())+" “+ String(rtc.getMinutes());
^
C:\Users\admin\Documents\Arduino\led2\led2.ino:44:19: error: no match for ‘operator!=’ (operand types are ‘int’ and ‘StringSumHelper’)
if(FLAG && LAST != String(rtc.getHours())+” “+ String(rtc.getMinutes())){
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from c:\Users\admin\Documents\Arduino\libraries\FastLED\src/controller.h:9:0,
from c:\Users\admin\Documents\Arduino\libraries\FastLED\src/FastLED.h:49,
from C:\Users\admin\Documents\Arduino\led2\led2.ino:4:
c:\Users\admin\Documents\Arduino\libraries\FastLED\src/pixeltypes.h:754:44: note: candidate: bool operator!=(const CRGB&, const CRGB&)
inline attribute((always_inline)) bool operator!= (const CRGB& lhs, const CRGB& rhs)
^~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\FastLED\src/pixeltypes.h:754:44: note: no known conversion for argument 2 from ‘StringSumHelper’ to ‘const CRGB&’
C:\Users\admin\Documents\Arduino\led2\led2.ino:46:63: error: cannot convert ‘StringSumHelper’ to ‘int’ in assignment
LAST = String(rtc.getHours())+” "+ String(rtc.getMinutes());
^
exit status 1
Compilation error: cannot convert ‘StringSumHelper’ to ‘int’ in assignment
Это неправильное объяснение. В 41 строке числовой переменной присваивается строковое значение. А далее эта числовая переменная сравнивается со строками. Т.е. полная хня делается
Это даже в теории не должно работать. Потому что число - это не строка, даже если в строке одни цифры. Это как попытаться перчатки вместо шляпы натянуть
Число не может быть пустым. Оно может равняться нулю, и нуль бы и выводился в порт. Раз этого нет, значит … подставь по своему усмотрению, что это значит