Arduino Mega Code: allow user to change settings while program is running.

Ολοκληρωμένο Αναρτήθηκε Πριν 3 χρόνια Πληρώθηκε κατά την παράδοση
Ολοκληρωμένο Πληρώθηκε κατά την παράδοση

Background:

Hi there. This is my first ever Arduino project, albeit an ambitious one. No coding experience at the outset, but doing my best to learn as I go. My code started simple... just take input from 4 BME280 temp/humidity sensors and display that info on an LCD and use that data to control a humidifier, dehumidifier, heater, and cooler via a relay.

Complicating the issue:

Now as time passes, I'm adding code to allow the user to change max and min temperature and humidity settings while the device is on and if settings are changed, write that to EEPROM in case of power loss. ( I know EEPROM has limited write per bit, so eventually was gonna add a counter for when the user changes settings so that it stores the variables in different bits) I'm also looking to include lighting schedules and clock settings (later on, once I add an external clock).

The Dream:

To accomplish the ability for the user to change settings. I wrote code to include a second LCD (lcd2) to display current max temp and min temp targets. The regular code will loop and bypass this "settings code" until the user selects settings with Button1 (out of 4). Once they select settings, I want the code to loop a different "settings code" altogether, and the LCD2 will display various setting changes.

Current Code:

I'm currently writing the settings code in a "while loop" starting on line 444 ( I know, a lot of code) and testing if different buttons are pressed and if they are, respond accordingly. So, button 1 starts "while loop" (user settings) it holds that button state in another variable so that this code loops until the user exits the settings with button 4. Button 2 confirms this setting as the one to change, button 3 moves to the next setting.

The Problem:

The code is starting to get out of control here... or at least seems to be. If I continue as is, the first while loop is going to grow tremendously until all the settings menus are written out. The code compiles, and may work (haven't tested in the real world yet) But it looks ugly, seems clunky, hard to understand, and I don't think this is the best way to write the code. Please, if you know how to write this in a better way, I'm open to any opinion or advice.

I'd like to add ability for User to change setting on LCD2 with buttons, these need to write to EEPROM when changed and cycle through different EEPROM bits to use them evenly.

I'd like to add a ChronoDot V2.1 High Precision RTC to the code. the user needs to be able to set the time.

I'd like to add settings for lighting control. on-off schedules.

all of these things need to control relays. code is already written for relays. but need to add code for lighting.

two separate lighting relay controls. lighting schedule 1... and lighting schedule 2

Arduino Ηλεκτρονικά Microcontroller Ηλεκτρική μηχανολογία Προγραμματισμός C++

Ταυτότητα Εργασίας: #27807018

Σχετικά με την εργασία

14 προτάσεις Απομακρυσμένη εργασία Ενεργό Πριν 3 χρόνια

Ανατέθηκε στον:

ansarccet

Hi there, greetings I have good experience in embedded system programming specially arduino, posses good expertise in multiple components and sensor interfacing with managing the control flow of program. I have gone th Περισσότερα

$50 USD σε 7 μέρες
(25 Αξιολογήσεις)
4.3

14 freelancers κάνουν προσφορές κατά μέσο όρο $148 για αυτή τη δουλειά

nikitamorozzz

Hi I am reliable firmware freelancer whom you are looking for. I read your proposal carefully and I noticed you want. As far as I am concerned, you will get good results working with me. In the past, I have realized t Περισσότερα

$200 USD σε 3 μέρες
(28 Αξιολογήσεις)
5.6
ah7med

Hi there, I have read your requirements, is depending on what you want to do with it. I have made a lot of projects with Arduino. After we make some command to move. I can work with all types of Microcontrollers progra Περισσότερα

$222 USD σε 7 μέρες
(15 Αξιολογήσεις)
5.0
Provi11

I have 3 years experience in Iot and p systems and have good hands on both hardware and software. I have worked on many projects that are as follows: Raspberry pi projects with Python and C Servo motor control through Περισσότερα

$140 USD σε 7 μέρες
(5 Αξιολογήσεις)
3.6
elect2eng

Hello, I went through your code. You are right, there is a better way to structure the code. Please let me know if you want me to rewrite it for you and add the other functionality, First suggestion is that you may clu Περισσότερα

$250 USD σε 7 μέρες
(4 Αξιολογήσεις)
2.0
eyadbas

Hi, sir. Thank you for sharing your project Arduino Mega Code: allow user to change settings while program is running., and I would be very happy to help you with your business. Let me share you with my expertise in El Περισσότερα

$155 USD σε 2 μέρες
(0 Αξιολογήσεις)
0.0
santhosh18199

Myself electronics engineer and working in the industry more than 3 years, i have read the entire details you have provided, i can able to solve your issue

$35 USD σε 5 μέρες
(0 Αξιολογήσεις)
0.0
nabeel1032

I've recently worked on my own project based on Arduino Mega2560 and used EEPROM and RTC too in that project. and also controlled Relays for switching so it would be lot easier to carry on with your project. I've good Περισσότερα

$139 USD σε 10 μέρες
(0 Αξιολογήσεις)
0.0
sksivasabapathi

I am an mechatronics engineer. I have more knowledge in microcontroller especially arduino so i am suitable for ur project chat me in chat box

$147 USD σε 7 μέρες
(0 Αξιολογήσεις)
0.0
mikrodesign8

Sir, On reviewing your project details i found that I can resolve your issue and fulfil the dream for your project. I can help you achieve you goal by reprogramming the complete code instead of EEPROM i would like uti Περισσότερα

$150 USD σε 25 μέρες
(0 Αξιολογήσεις)
0.0
nmadhusuthanan

Dear client, When viewing details of the project, it really jumped out of me. I have extensive experience in arduino programming & also in interfacing the sensors. I have worked on industrial application using arduin Περισσότερα

$250 USD σε 7 μέρες
(0 Αξιολογήσεις)
0.0