Which one would i use and how do you change one of those numbers with say 2 bottons? One button up and one button for down for each hour and minute minute?
I have a nextion display where i can have all the buttons in the world.
My code is wayyy to large to post. It exceeds the post limit but i can do a snippet if needed.
I hope this makes sense as im not to sure how to ask the question. Im close as heck to finishing this project and i just need this settings part done.
But how do you change that with input from a person?
Like im gonna assume im gonna use a counter for this
So like button press (counter++)
{Int ++}
But what im having and issue with is what do i put in the first {} like how do i specify that i want to change that int.
And how do i save it so it stays at that number with each loop
Or does it just stay there automatically?
If you give some details of what you're actually trying to do we could probably help. But trying to explain the entire language to you one statement at a time with no idea of why you want to know is way too much like hard work. There are plenty of Arduino and C++ tutorials, try the top of the page under Resources or the many example programs in the IDE.
OTOH if you have a real program in mind tell us what it's supposed to do, post your best attempt at it and say what problems you're having. Then we'll have something to start from.
But how do you change that with input from a person?
Like im gonna assume im gonna use a counter for this
So like button press (counter++)
{Int ++}
But what im having and issue with is what do i put in the first {} like how do i specify that i want to change that int.
And how do i save it so it stays at that number with each loop
Or does it just stay there automatically?
make a little program that attempts to do what you want it to ... then try it.
I have a 8 relay board.
Each relay is connected to a light or a fan.
I have the code all written and what not for a headless
System. You would just need to modify the code in the ide
To change any light times. Or pump times or whatever.
Im trying to add a display to this now.
I need to know how to change these times with button presses so i dont need to change it from the idea.
The code is written and everything and its way to long to post. It exceeds the max posting limit.
So
What im having problems with is how do i start to set up the code for the adjustment of int with push buttons?
Im bad at explaining myself and i think i lack the right terms for this situation
Im trying to make it from a headless program that
Can only be modified from within the ide
To a program with a tft display.
What i need is to be able to change some numbers
With buttons so i can test it to move onto patching
The tft controls threw.
The only part in this i havent learn is
How to change int numbers with a button.
Ive been doing this for only a week so calm
Yourself. Ive gotten some amazing help from people
So either be one of those people or move on from
This and go moderate some other stuff or whatever
A mod is supposed to be doing. Instead of being a troll
AWOL:
Me neither - I can't see it.
I have no idea what that means.
So ill try to post the file?
And i dont know what it means either. I dont know what term im trying to use.
You know when you get one of those wall timers?
And you can put an on and off time.
Im trying to do that part where you use the buttons to change the time it turns on and off
And i dont know what it means either. I dont know what term im trying to use.
You know when you get one of those wall timers?
And you can put an on and off time.
Im trying to do that part where you use the buttons to change the time it turns on and off
All I can see is a lot of hand-waving (without using a shift key)
k so ill show you here what i mean buy what i want to change,
i know i need to change it from "#define" to "int"
ive attached the whole code, what i want is to change all the times below with buttons instead of going into
the ide, changing them and then re compiling the code, does that make sense?
//LIGHT ON AND OFF TIMES
//Light 1
//on
#define light1OnHour 2
#define light1OnMinute 1
//off
#define light1OffHour 14
#define light1OffMinute 1
//Light 2
//on
#define light2OnHour 2
#define light2OnMinute 6
//off
#define light2OffHour 14
#define light2OffMinute 6
// PUMP ON TIMES (24 HOUR FORMAT)
// pump on times 1
#define pump1ONhour 2 //hour
#define pump1ONmin 0 //minute
#define pump1ONsec 0 //second
// pump on times 2
#define pump2ONhour 6 //hour
#define pump2ONmin 0 //minute
#define pump2ONsec 0 //second
// pump 1 on times 3
#define pump3ONhour 8 //hour
#define pump3ONmin 0 //minute
#define pump3ONsec 0 //second
// pump 1 on times 4
#define pump4ONhour 10 //hour
#define pump4ONmin 0 //minute
#define pump4ONsec 0 //second
//amount of time water is on for; watering length ; delay untell off
#define watertime 17000
//amount of time circulation pump turns on BEFORE water pump does (use negative)
#define circulationbefore -1
//amount of time circulation pump stays on for AFTER water pump does (use positive)
#define circulationafter +15
what i want is to change all the times below with buttons instead of going into
the ide, changing them and then re compiling the code, does that make sense?
Yes, you want take all the #defines, type them as integers, and re design the program to have a user interface for changing those variables. I think you said you want to use buttons on a tft display? Designing a touch screen graphical user interface (GUI) is not trivial and you will not get a quick and easy answer here.
Start with a Google search "tft user interface for Aduino" will probably get you started.
If you have some other user interface in mind like a smart phone, physical buttons, a laptop or other pc Google can get you going there as well.
Yes, but they look like they're written by someone who isn't sure what they want to do, or even how to explain themselves, so I'm just assuming the worst case, but falling some way short, it seems.
dont worry about the tft display worry about my question, i got my gui built and everything ready, but kinda pointless when
i cant tell the buttons what to do, right?
i dont know wtf im trying to ask , so i wrote this code to try to explain what i want, maybe i got it right?
i know i need to redo it for every int i have, so like ( timeon1hour, timeoff1hour, and etc)
but is this correct? will "number" be seen by the number i button myself to
int number = 0;
int timeonlights = number;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(5, INPUT);
pinMode(6, INPUT);
}
void loop() {
if(5 == HIGH)
{
number = number +1;
Serial.print("number plus one");
Serial.println(number);
}
if(6 == HIGH)
{
number = number -1;
Serial.println("number minus one");
Serial.println(number);
}
// because rtc3231 uses 0 as a number, 0 = 1 and 23 = 24
if (number > 23)
{
number = 0;
}
}