I’m using an arduino mega with a keypad 4x4, a rtc3232, a LCD Screen 4x20, a button on…
- User
I’m using an arduino mega with a keypad 4x4, a rtc3232, a LCD Screen 4x20, a button on pin 4, and 12 relays (from pin 34 to 46). I’m using those libraries : <Keypad.h>, <Wire.h>, <LiquidCrystal_I2C.h>, <DS3232RTC.h>, <Streaming.h>. I want to, when i press the button, to whow the following menu withsub menus and show it ont the lcd screen: main menu : press ‘A’ to go to the sub menus « Relays Managing », press ‘B’ to go to the sub menu « Informations », press ‘D’ to quit the main menu and shut dows the screen. When you press A, it opn the first sub menu asking the number of the relay you want to manage (and collect this number with the keypad). Then, with this relay, thee sub menu propose to press keys : key ’A’ « ON/OFF », swith the relay statut (if it’s high, turn it to low and reverse), key ‘B’ « TIMER » rely high during a number of minuts (collected with the keybord, from 1 to 999 minuts), ‘C’ « Program with timer» (start hour and minuts collected with the keypad, then the functionning duration collected with the keybord). ‘D’ « exit » to quit the sub menu. The second sub menu (‘B’ information) have to show a second sub menu with « A – temperature info » (will show float numbers stocked in temp1, temp2, temp3, temp4 if pressed), « B – humidity info » (will show float numbers stocked in hum1, hum2, hum3, hum4 if pressed), « D-Quit » to live the sub menu.
- Assistant
- User
I want you complete just the relaysMenu() after the last char key = keypad.waitForKey(); I added in the code the wollowing 4 tables where i want to stock informations depending of the relay number. bool relayStates[NUM_RELAYS]; int timer[NUM_RELAYS]; int hour[NUM_RELAYS]; int min[NUM_RELAYS];. If press ‘A’, if relayStates[relay]==1 then relayStates[relay]=0 else relayStates[relay]=1. If press ‘B’, relayStates[relay]=1 and timer[NUM_relay] = value of the keypad (from 1 to 999). If press ‘C’, relayStates[relay]=1, hour[relay]= value of the keypad (from 0 to 24), then min[relay]= value of the keypad (from 0 to 60), then timer[relay] = value of the keypad (from 1 to 999). If press ‘D’ quit the menu and shut down the screen.
- Assistant
Here's the updated
relayMenu()function with the changes you requested:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.