Mak'er Grow
Well-Known Member
I'm using a Mega 2650...started with an Uno, but ran out of space quickly when I got the LCD shield and upgradded to the Mega.I haven't looked through your code yet my head is splitting, but if you are using a device over SPI (serial peripheral interface) that has MOSI, MISO, SCK, , SS, GND, VCC on an Arduino Mega they use different pins then an Arduino Uno.
Specifically MISO=50, MOSI=51, SCK=52 and SS=53. You can also just connect it straight to the ICSP header but documentation is uh confusing if you're not a pro at all of this (I am not, I am telling you this from my own headaches in experience).
You never said what you're problem is though? Does your code actually work? If not where and what errors is it spitting out?
If it fits on the controller optimization isn't really that important, unless you're going to be like selling these or something. But if it works and fits thats all that matters.
I can PM you my gardener's microcontroller code if you want but TBH all you really need to know how to do is load the correct libraries into the arduino IDE and they all come with a bunch of example codes that you can just copy/paste and modify a few variable names, function calls etc.
If you are planning to use a camera module and save pictures onto an SD card I *highly* recomend that you get something like an adafruit data logging shield. I have tried to do it with just the parts (SD card reader and an RTC) but it is truly a PITA that requires you resoldering a point on the SD card reader because they're generally not wired to work out the box on SPI connected to an RTC.
As for the ICSP header I'm using a few pins from it for other things...power to the I2C sensors and the reset pin for them too...instead of soldering lines on the mega directly.
The problem I'm having is I see long lists of similar lines and got to wondering if it possible to shorten them down in to some smaller routines of sorts. Also clean up any other things that could become problem(s).
Previously I was having a bit of trouble with loosing about 7 minutes a day on the clock for some reason until I added WTD and an hourly resync to the RTC...if it fails a resync 5 times the whole thing resets which brings back time properly and seems to work, but my mind wonders if theres a better way to do this...lol
The code does work as is tho...turns lights on and off...pumps...reads humidity and temps...reads info from files on the SD card for the data for timers or if not found then it defaults to what has been preset in the code...simple things.
I'm just working now on the touch screens and buttons to make changes of values and also figure out how to re-write the SD data that matches it.
Looking for a solution to keeping button screen(s) wait for some input...they just show now and then code goes back to main screen even without a button choice...think I have a solution...I'll be trying it later today/tonight.
I do that exact thing...using the examples and code for the net...alter things to figure out how it works and then implement it in to my code...so learning has been kind of slow here and there, but I'm getting better...I think...lol
As for the data logging shield...theLCD screen has a micro SD slot built into in and my RTC is another shield...I did get some data logging working before so I figured it should work basically the same for pics...the only trouble for the cams I see right now is I've read the ones I bought are non-fifo and need something extra to work as well as some lines converted from 5v to 3.3v or something like that, but I'll deal with all that after.