this post will indicate some of the problems. please read through the suggestions. if you don't, you'll probably be pointed to it anyways so you might as well save yourself the time.
1. learn how to upload code to your arduino. if you dont know how to save and upload sketches and VERIFY that the sketches have been actually uploaded, you will not be able to get your project working. this is a big problem. see Arduino tutorial part 1 for how to upload new code. make sure you get a Done Uploading notice. note on the screen, if you see any errors or failures, your code didnt upload so you have to fix it before continuing.
2. Understand the difference between setup() and loop(). setup() occurs only once, loop() occurs constantly. For more information see Arduino tutorial part 2.
3. Learn how to use Serial.print() Printing is key to debugging. You must print out variables, notes, and hints to yourself about what is going on constantly. Not sure if your temperature sensor is working? Print out what the analogread() function returns. make sure that all the numbers make sense. Not sure how many times a loop is running, or if its running at all? Print out an incrementing number. For more information see Arduino tutorial part 4.
4. Never say "It doesn't work" There is nothing more useless than the phrase "It doesn't work". Its like going to a doctor and demanding treatment but never telling what the symptoms are. You have to define what "it" is - is it the code? is it the LCD? is it the sensor? Second, you have to explain "doesn't work", how do you know it doesnt work (often times, its working fine but the user doesnt understand that). What have you done to verify that its not working? Do you have an examples of it working ever? What should it be doing? Describe as -precisely- as you can muster.
5. Use the
Code: Select all
tag.[/b] Its a button up top, see? it says code! its for pasting code cleanly. and cleanliness is near godliness, so use it!
[b]6. If you must post code, post the minimal code that demonstrates what doesn't work[/b] Your temperature sensor doesnt work. OK, that may be a problem...maybe its broken? maybe its not wired up right? But why are you pasting a sketch that has LCD and ethernet code in there too? Make a new sketch with all the extra stuff deleted, if it still doesnt work, you can post that because at least you're debugging only one thing. (see below)
[b]6b. If you're posting code and claiming that something doesn't work, make sure the code -shows- that it doesnt work[/b]. If your LCD doesnt print on the second line, post code that shows you at least tried to print to the second line.
[b]7. For every component in your project, have a sketch that JUST tests that component and nothing else, using Serial.print() to tell you that it works[/b] Have an RGB LED? Are you sure you know the pinout? Might be handy to have a sketch that only tests that part, that way if you break it, there's a quick way for you to verify
[b]8. Don't eat a cow in one bite[/b] Code increases in complexity/difficulty the longer it is. That is a fact.
Lets say you want to make an internet-enabled cat-feeder (so you can feed your cat over the internet, of course!) Do not try to write all the code and then click compile and pray. That is foolish! Instead, just get a motor turning. Once that works, attach the motor to the cat feeding device and verify it works with serial commands or button presses. Then figure out how to get an LED to light via an Ethernet shield. Finally you can combine the two halves (motor/servo control and Internet control).
So if your internet-controlled-cat-feeder doesnt work, and you need help, don't just dump 300 lines of code and say "HALP". Instead, have little tester scripts that verify each part of the project to determine what is breaking!
[b]9. Post nice clear photos or schematics[/b] Sometimes the problem is wiring. In fact, much of the time the problem is wiring. This is unlike software where there is rarely any wires involved. For that reason, you should learn out to take a good, clear photo. An expensive camera is not required but good lighting, some care and setup is. Don't want to bother with all that? Draw a clear schematic or diagram. Think that takes too much time? Those that request help from others need to spend a little effort.
[b]10. Did you look through the forums/internet?[/b] There are literally thousands of posts on various forums that Arduino users visit, including at arduino.cc and other sites that google indexes. Did you use the search box to see if maybe your problem is common? Most problems are the same issue occurring over and over again. You'll learn a lot, even if its not the exact same problem you're having.
[b]11. Spend more time on it[/b] Your friend bought a piano yesterday, but hes upset because for some reason everything he plays sounds awful. Whats up with that? Its because he's never practiced! Electronics, like any skill, requires many hours (even years) of practice. It is not unreasonable to spend a week on a problem, trying different approaches, looking at example code, reading books, examining datasheets, using search engines, all to find a solution. Is it frustrating? Yes. But note that the only way to learn is to have difficulties. When everything goes right, there is no lesson learned. Persevere! Ganbatte!