Go Down

Topic: Chicken Coop - LCD + 2 Fans + 2 Lights + RTC + DHT11 + Stepper (Read 3 times) previous topic - next topic

34DOL

Maybe I have not been clear about what I have done.  Let me simplify...

I wrote code for the LCD with just the LCD attached.  Tested it and it worked, so I moved on.

I then wrote code for the DHT.  Tested it and it worked, so I moved on.

I then wrote code for the RTC.  Tested it and it worked, so I moved on.

As the RTC and DHT were successfully communicating with the Arduino which was successfully displaying their data on the LCD, and both the RTC and DHT are needed in the code I am writing for the relays, it was time for me to write code for the last step, using the RTC and DHT data to control the relay board.  Before I did that, I took one step sideways and I tested that the Arduino communicates successfully with the relay board using a simple loop on/off code and that worked.

PaulS your suggesting that I should "develop a series of little sketches that demonstrate that the individual pieces all work" and then, "when (I) know that that happens, start combining them, two at a time" is, as you can now see, exactly what I did.  But good advice none-the-less and maybe it will help someone else reading this post on one of their projects.

I apologize if this was not clear in my initial post but like I said, we are limited to 9500 characters.  And to PaulS suggestion that that does not include attached code, yes PaulS the 9500 character limit does include attached code.  Deleting the comment lines out of my code is what got me under 9500 characters.

@liudr, I am using an LCD shield, everything else is connected through that shield to the Arduino.  Your shields look do look great though and I may look to use them for another project, but for this project, I already have all the pieces I need and just need help with the code.    If you think the libraries or code you have written for them will assist me with using what I already have, please send my way.  Thanks

Here is a list of what I am using:
  Tiny I2C RTC DS1307 AT24C32 Real Time Clock Module For Arduino AVR ARM PIC
  L298N Dual H Bridge DC Stepper Motor-Treiber Controller Board
  5V 4-Channel Relay Module Board for Arduino PIC MSP W/ Optocouple SRD-05VDC-SL-C
  DHT11 Arduino Compatible Digital Temperature Humidity Sensor Module+Dupond
  1602 LCD Board Keypad Shield Blue Backlight For Arduino Duemilanove Robot

liudr


PaulS

Quote
I apologize if this was not clear in my initial post but like I said, we are limited to 9500 characters.  And to PaulS suggestion that that does not include attached code, yes PaulS the 9500 character limit does include attached code.  Deleting the comment lines out of my code is what got me under 9500 characters.

The 9500 character limit refers to posted code. That is code in this box. And text. But, see down there? Below this window? The Additional Options link. Well, OK, so it does not look a lot like a link. But, it is. Select that. You can attach much larger than 9500 character files.

I am happy to hear that you are developing the code in pieces. That wasn't clear from your post.

I still think that those delays have got to go. The millis() function and a state machine (what do I need to do on this pass through loop, if is is time to do anything) is much better than sitting on your hands for relatively long periods of time.

34DOL

Got it.  Was just following instructions.  The forum says to post code between
Code: [Select]
using the #.

Anyways...  Which delays do you suggest I delete?  All of them?  Are you suggesting the delays are causing the issue?  If I don't have any delays, won't that cause a display issue on the LCD (i.e. the data won't be displayed long enough for anyone to read it)?

What is the millis() function?

PaulS

Quote
Anyways...  Which delays do you suggest I delete?  All of them?

If I ask you to make me breakfast, consisting of eggs, bacon, toast, and coffee, can you figure out how to make all the food get done at the same time? Or, am I going to gets eggs, then, some time later, bacon, then, some time later, toast, and finally, after I've finished eating, the coffee will be ready?

Yes, all of the delays.

Quote
Are you suggesting the delays are causing the issue?

I don't understand what the issue is. I don't see any serial out put that says "Time to turn the relay on" and "Time to turn the relay off", annotated to note whether that happened, or not. Calls to delay() do not belong in a sketch that is doing more than blinking an LED.

Quote
If I don't have any delays, won't that cause a display issue on the LCD (i.e. the data won't be displayed long enough for anyone to read it)?

Not if you don't immediately overwrite the data. See the comments above.

Quote
What is the millis() function?

Is it necessary to point out that up there at the top of the page there is a link that says Main Site, and that on that page there is one that says Reference, and that on that page all the Arduino-specific functions are documented?

Go Up