Solved problem, but new problem arose! Title edited accordingly, and new version of code added as attachment. As posted in Reply 5 in this thread:
I’m having a different problem now, same code - now Line 7, which is simply
const char *ssid = "YOUR_SSID"; const char *password = "YOUR_PASS";
Is giving me the following error:
'const char* ssid' previously defined here
That’s the short version, but the code repeats for basically everything defined prior to “void.setup”; the cactus.io, constant char *password, etc.
I’ve read online this can be caused by creating backup copies of your .ino file (which I did), so I tried removing those from the Arduino folder but still experiencing the issue. Any recommendations?
Looks like just this and another few small errors to fix and it’ll be ready to go; thanks again for your help and for everyone who has posted in other topics, really been a huge help.
I am (if the code works beyond Arduino’s recognized errors) approaching the end of the first version of my project. I am encountering an error I’m having a hard time understanding: “else without previous if” despite an equal count of both if/else statements.
This is my first attempt at coding anything beyond changing some colors or images on a web page, so expect ugly code and noob errors. Most of the code came from kind assistance from this board or Reddit combined with online tutorials so it’s very possible I made errors in combining the sections of code, or other errors. But to my untrained mind, that doesn’t seem to be the problem here.
Essentially what I’m trying to do is tell my NodeMCU, “Run this code for this part of the day, and if it’s not that part of the day, run this code”. Then I could just adjust one set of time parameters instead of both. I could probably just do two separate “if” statements and define separate time periods, but that’s a minor inconvenience and I don’t understand why this isn’t working anyway.
Arduino’s auto formatting indents the first “if” statement more than the error-inducing “else” statement which makes me think it’s some problem with how I set up the code somewhere along the way, but all my brackets are balanced from what I can tell, as if I add any more closing brackets than I have, it closes the void.loop function prematurely. And I’ve already had to fix previous errors with too many or too few brackets so perhaps a different issue in formatting, but again, no experience. A Google search revealed issues related mostly to misplaced semicolons/etc in the code, which I don’t seem to have at least within the “if/else” related lines.
I’m sure the problem will be obvious to someone on this board, just demonstrating I am trying to solve it prior to posting lol
Attached both my full code (Project Jun23…txt) and a “map” of the if/else statements in my code; bold is “if”, italic is “else”. There are 9 of each and the structure makes sense to me logically but there’s clearly an error in the code somewhere. If it’s just some basic error with having too many or too few brackets I apologize in advance, but I’ve encountered those errors before and this doesn’t seem to be one of them. “If/else” structure starts on line 77 and ends on 176, error occurs on 127 (the else which acts as the “bridge” between the day and night conditions).