I'm busy with an aquarium controller based on the arduino mega with an 3,2 inch touchscreen.
I'm writing the code right now but I don't have the screen yet , and I want to test how it would look like.
Is there something like a simulator so I can see how it looks like on my computer?
Senne:
Is there something like a simulator so I can see how it looks like on my computer?
There is an Arduino simulator, but I've no experience of using it. A search for 'Arduino simulator' should find it for you. I doubt that this would include a visual simulation of your proposed display, but you always have 'MS Paint' available if you want to imagine what that would look like.
Yes , I know I have microsoft paint , but I just wanted to know if my code was right and everything was placed at the correct place.
And all of the arduino simulators I've downloaded up till now did'nt work
Yes , I know I have microsoft paint , but I just wanted to know if my code was right and everything was placed at the correct place.
And all of the arduino simulators I've downloaded up till now did'nt work
void TimeDateBar(boolean refreshAll=false)
{
String oldVal, rtc1, rtc2, ampm, month;
if ((rtc[1]>=0) && (rtc[1]<=9))
{ rtc1= '0' + String(rtc[1]);} //adds 0 to minutes
else { rtc1= String(rtc[1]); }
if (setTimeFormat==1)
{
if (rtc[2]==0) { rtc2= 12; } //12 HR Format
else {
if (rtc[2]>12) { rtc2= rtc[2]-12; }
else { rtc2= String(rtc[2]); }
}
}
You will have a far easier time with coding if you pick a style and stick with it. Either the { goes on the line with the statement, or it doesn't (I prefer that it doesn't).
No recognized style recommends putting the } anywhere but on a line by itself.
Randomly indenting
the code makes
it very hard
to read. The Tools +
Auto Format menu
item will help with this.
There are virtually no comments in the code. While you might, today, be intimately familiar with the code, others are not. Will you still be if, a year from now, you want to make changes?
You should have a block of comments above each function that explains what that function does, at a minimum. It is not necessary to go overboard. We know what analogRead() does; there is no reason to document that.
Some of your function names leave a bit to be desired. One can look at a name like digitalRead() and pretty much KNOW what that function is going to do. What does check() do? What is it checking? Why are the inputs pointers? The memory pointed to by the inputs is not changed. Passing a byte pointer to a function actually takes more stack space than passing a byte by value.
Actually this is the jarduino aquarium controller code which I edited a little bit.
So you think this could be made more easyer ?
I will use much more comments , I only use this program to learn from it so I can compile one myself , but some functions (like lunar phase ) are really complicated and I couldn't figure them out on my own
but some functions (like lunar phase ) are really complicated and I couldn't figure them out on my own
The comments for those functions should, then, indicate where you begged/borrowed/stole the code from. There may be a time when you want to make changes, or check if anyone else has, and documenting where you got the code from will make it a lot easier to check.
The stuff you wrote should be well documented. The stuff you stole should be marked as such. I don't mean "stole" in any negative way. We all steal code and ideas on a daily basis, and there is nothing wrong with doing it. Unless the code is copyrighted. In which case posting it on the internet was dumb.