#include <EEPROM.h>
// Drive
bool drive_state_out = false;
// Feeder
uint32_t turn_time_1;
uint32_t turn_time_2;
bool feeder_active_1 = false;
bool feeder_active_2 = false;
// Floor
int8_t max_temp[] = {30, 30, 30, 30};
int8_t min_temp[] = {25, 25, 25, 25};
void setup() {
Serial.begin(115200);
Serial.setTimeout(50);
init_servo();
init_security();
init_feeder();
int16_t temp;
EEPROM.get(0, temp);
max_temp[0] = temp;
EEPROM.get(1, temp);
max_temp[1] = temp;
EEPROM.get(2, temp);
max_temp[2] = temp;
EEPROM.get(3, temp);
max_temp[3] = temp;
EEPROM.get(4, temp);
min_temp[0] = temp;
EEPROM.get(5, temp);
min_temp[1] = temp;
EEPROM.get(6, temp);
min_temp[2] = temp;
EEPROM.get(7, temp);
min_temp[3] = temp;
for (int i = 0; i < 4; i++) {
if (max_temp[i] == -1) max_temp[i] = 30;
if (min_temp[i] == -1) min_temp[i] = 25;
}
int8_t floor_setup[] = {
max_temp[0], max_temp[1], max_temp[2], max_temp[3],
min_temp[0], min_temp[1], min_temp[2], min_temp[3]
};
sendArr("flr_setup", floor_setup, 8);
init_floor();
}
void loop() {
readSerial();
handle_security();
handle_feeder();
handle_floor();
delay(10);
}
Loading
ds18b20
ds18b20
Loading
ds18b20
ds18b20
Loading
ds18b20
ds18b20
Loading
ds18b20
ds18b20