The arduino nano portion of the project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
735 B

  1. #include <ArduinoJson.h>
  2. #define RELAY_ON 0
  3. #define RELAY_OFF 1
  4. #define BALLAST_SIZE 3
  5. struct ballast
  6. {
  7. int id;
  8. int shour;
  9. int smin;
  10. uint32_t fadePeriod;
  11. int ehour;
  12. int emin;
  13. int stage;
  14. int brightness;
  15. int pin;
  16. unsigned long fadeStartMillis;
  17. int relayPin;
  18. };
  19. void setupBallast(ballast *b);
  20. int setupBallasts(ballast *b_arr[], size_t arr_size, JsonObject &root);
  21. void doBallast(ballast *b, int hr, int mn);
  22. void updateBallast(ballast *b, JsonObject &root);
  23. void manualMode(ballast *b);
  24. int getFreeRam();
  25. const size_t bufferSize = JSON_ARRAY_SIZE(3) + JSON_OBJECT_SIZE(2) + 3 * JSON_OBJECT_SIZE(5) + 180;
  26. const unsigned long loopPeriod = 1000;
  27. const unsigned long data_send_period = 2000;