Well, hello everyone. I need help on a project where I want to select some "settings", it's just for my knowledge, but I'm really struggling with how I make this work. Basically, the first configuration works well, the LED blinks once per second ok, but in the second configuration it should blink twice quickly, and then start the cycle again after a second, but I don't think how to do this without it looking weird or else the rhythm gets out of line after a few seconds. Please someone give me a tip. Here's my code so you can take a look...
not clear whether a button is active (pressed) HIGH or LOW
looks like in progtime() 2 buttons need to be active at the same time
don't understand why the state of a button is a condition in a while loop
so many actions are conditional on some elapsed time,
why do you have code controlling the same LED in both progtime() and pisctemp()? why not have on sub-function that handles the buttons and another the LED
above looks like there are cases when timers may result in conflicting operations. in the case below won't the condition depending on tempA1 being >= 400 also be true when the 2nd condition, tempA2 >= 800 is true
buttons are typically connected between the pin and ground, the pin configured as INPUT_PULLUP to use the internal pullup resistor which pulls the pin HIGH and when pressed, the button pulls the pin LOW.
Oh! Sorry about my lack of information. I like programing in Esp32, and them i realized i dont know how to save things in flash memory, them i started writing this code. What i want to do is: three modes, mode one: led blinks second to second, mode two: led blinks 0,5 sec faster and mode three: led goes anything differente than last two ones. So how do i save the modes? Putting a jumper between "progjump" and GND, them my while holds all the rest of my program and focus on showing what mode now is working. If mode one, led blinks one time second by second, if mode two, led blinks two times fast, them turn off for one second and starts again over. Well, i think you got what third mode should do, but i dont even get past mode two, probaly i am too dumb for this. Some extra: Why i am not using delay? Well would be more simple just use delay, but i cant, because esp32 cant handle "delays" if connected with internet, and i want mine little "librarie" working i any cases, with internet or no, them i need millis for this :/.
-Yes! Progtime need "2 buttons", one of them is a jumper between progjump and gnd.
While is for when i jump progtime, the program stops everything and focus on the modes, showing which mode is avaliabe now, blinking the "number"
They control the same led but not at the same time! And how could i do this sub-function? Can you give me a example what is it? Sorry about my sillyness, im trying to study everything i can do with this guys (prototype microcontrollers).
About i didnt used the INPUT_PULLUP, im training to start developing my "own" PCB's, them i use a resistor in protoboard doing the pull down
Well, "focus in the modes" i think like, everything that doenst matter stop and we can change the mode presset, for me this make sense XD but i dont think arduino needs time to "focus", its just me saying syllines things =p
About the 5 modes, why them? I just need Three (at moment), if i know how to do three, i can do more after!
And sorry about the loooong time until my answer, i was in work, sooorryyy~
you say you have just three modes and they are in piscatemp() indexed by the value of ledconfig. but in progTime() you have 2 "cases" also indexed by ledconfig. seems like ledconfig is the mode variable
it would save time now, for both you and us and in future projects if you could both more clearly state what you are doing or are trying to do, as well as want to do
Sorry about the confusion i created, im not really good making my codes pretty or even understable.
You right, just three modes in piscatemp(). The first case in piscatemp() reads ledconfig to know what mode is now, and progtime reads ledconfig so he can "display" which mode is working now.
Yeah, big part from confusion was because i didnt know how to say what i was trying to do, next time i will add some "//" with clear comments! Thx for the tip.