manhoosbilli1

motor sketch working with rtc and alarm

Jul 8th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. #include <Wire.h>
  2. #include <LiquidCrystal_I2C.h>
  3. LiquidCrystal_I2C lcd(0x27, 16, 2);
  4. #include <Bounce2.h>
  5. #define NUM_BUTTONS 3
  6. void setup() {
  7. // put your setup code here, to run once:
  8. pinMode(btn_up,INPUT_PULLUP);
  9. debouncer1.attach(btn_up);
  10. debouncer1.interval(25); // interval in ms
  11. pinMode(btn_down,INPUT_PULLUP);
  12. debouncer2.attach(btn_down);
  13. debouncer2.interval(25);
  14. pinMode(btn_select,INPUT_PULLUP);
  15. debouncer2.attach(btn_select);
  16. debouncer2.interval(25);
  17.  
  18. //ask if the user wants to start incubating procedure if
  19. //not already in the process
  20.  
  21. }
  22. enum pages {
  23. DEFAULT_SENSOR, CALCULATE_HATCHDATE,
  24. MANUAL_MTR_TURN, MOTOR_DEMO, TOGGLE_ALARM SHOW_TIME,
  25. };
  26.  
  27. int currentPage = DEFAULT_SENSOR;
  28. void loop() {
  29. debouncer1.update();
  30. debouncer2.update();
  31. debouncer3.update();
  32. Up = debouncer1.read();
  33. Down = debouncer2.read();
  34. Select = debouncer2.read();
  35.  
  36.  
  37. }
  38.  
  39. void menu() {
  40. case DEFAULT_SENSOR:
  41. //updateAlarms(); this will contain all the timers
  42. lcd.setCursor(0,2);
  43. lcd.print("T: ");
  44. //show temperature from sensor
  45. lcd.print("34.6 C*");
  46. lcd.setCursor(1,2);
  47. lcd.print("H: ");
  48. lcd.print("50 %");
  49. //show humidity from sensor
  50. break;
  51.  
  52. case CALCULATE_HATCHDATE:
  53. break;
  54.  
  55. case MANUAL_MTR_TURN:
  56. //if button pushed
  57. //turn on the flag
  58. //the function will run it once and then turn off the flag
  59. break;
  60.  
  61. case MOTOR_DEMO:
  62. //motor will go to the other switch stay there for 10 seconds
  63. //and then come back to original position.
  64. break;
  65.  
  66. case TOGGLE_BUZZER:
  67. //will read from eeprom status of alarm
  68. //if enabled it will disable the alarm
  69. //if disabled it will make the alarm buzz for 2 seconds and
  70. //then turn off giving a message as "succeful"
  71. break;
  72.  
  73.  
  74. case SHOW_TIME:
  75. //will show time for 5 seconds and go back to default page
  76. break;
  77.  
  78. }
  79.  
  80.  
  81. void updateAlarm(){
  82. }
  83.  
  84. void updateBuzzer(){
  85. }
  86.  
  87. void countDownForHatch(){
  88. }
Add Comment
Please, Sign In to add comment