hey i am spotting a few things that would be easier to show with copy/paste code instead of me sending a million pictures with arrows.
first thing is why is this call at the end of the function?
View attachment 110854
doesn't make a lot of sense to read the temperature here and then lose the data at line 96 with the "}" meaning once this is called the data is then lost. it also looks like there are few
global variables, or variables initiated outside of this code block. I would need to see those too to fully understand the entire code. Lines 65-67 seem to be logic to check if 1 second has passed, but everytime this loop runs the timepoint is being reset in line 65, meaning only if 1 second has passed from the time it took the cpu to process line 66 to 67 might never happen therefore that entire if() block might never run. it is only measuring if one second has passed in 2 lines of code which is done in under 1 millisecond on any modern computer. most CPUs can run trillions of processes a second, if the device is very slow this might work, though it is very "iffy". The solution to this would be to have the timepoint outside of this block of code meaning it can retain it's value in between loop calls.
therefore if that if() code doesn't run then all of the follow code from 80-89 doesn't have the new temperature and ph values because it didn't run.
then like i was saying lines 93-94 do nothing but get data and then discard it, because it is at the end of the loop() and these are static variables not global, meaning they are initialized (line 94) then discarded from the memory stack at the end of the loop in line 96.
i don't want to bore everyone to death, but prob be best to help you in a private chat, send me the raw data in text format, and outline any changes you made after you got the code will help me to analyze any flaws in the logic much faster.
ohhh i love this stuff lol, i'm sure this is a headache to most people but i love it!
this isn't anything too crazy, now trying to design 3d shapes in a 2d world using antiquated Open GL, that was a nightmare for me in school. if you don't perfectly connect your shapes in an imaginary 3d space, nothing will be filled correctly with the colors, the shading won't work, etc...
just to give an idea, just to make a simple 3d pyramid rotate in 3d space was a few thousand lines of code... a lot of is boilerplate stuff like standard code to setup this 3d world, but that didn't make the thing any easier lol
i just realized it prob came off in a bad way when i said comp science major, but it was a humble flex for someone who didn't get a degree until after 40 and has been in and out of jail more than once, and had to work his way up the ladder from the manufacturing floor due to my age and lack of experience in the field i love but was too much of a rebel or dumbass to ever pursue while younger
Edit: also almost got expelled in high school for crafting a home made virus i called the "Viral Messiah" (my anarchy days) that corrupted the entire school network of data 1 week before report card release. no one caught it, printed the report cards, nothing was right, and then took 3-4 weeks for reentering the data after they got the system back up. OOOPS lol. i made it at home and wanted to test it on a system not connected to me. didn't think about when i ran it on the teachers computer he had full access to the network so the thing just spread like crazy! thankfully my computer science teacher in high school (first year it was started was when i was in, 1997) vouched for me to the principal saying he didn't mean anything malicious, this kid has a bright future and is crazy smart. this was after my teacher tried to call me out in front of the class for using copied source code from the internet to make a complex program he thought was out of my realm. back then i didn't comment anything, so he started to drill me asking me what does line XXX do what does line YYY do, and my answers were so fast and detailed he on the spot apologized and didn't know what else to say but give me access to his computer anytime i wanted and all of the developer tools to install at home for free back when this stuff was a few hundered dollars just to compile anything. that was how i made the virus.... lol
love you guys and glad i can help! yeah just PM me and we will get this all squared away in a few days! might be a little trial and error as i understand the underlying function calls for sensor readings.