programming

hello im new in this area. i want to ask if someone can guide me code for the arduino to correlated with servo motor but depends on LM34 (temperature sensor). deepest thanks. here i attach the picture of my group project.

uhev6aSv5IIxOA5w.jpg

Do you have code for the servo motors (using the Servo library) ?
Do you have code for the LM34 ?

The Arduino 5V pin is a 5V output. It can supply perhaps 100 to 300mA.
A single servo motor needs 500mA when it starts rotating, but it might even be 1A.
You have to use a seperate powers supply to power the servo motors.

Sure, but before you start your project, google, LM34 Arduino, and servo Arduino.
Many examples on the WEB.
Go thru the basic examples that come with the IDE to get some experience in programming.

hi afryan_!

perhaps you should have a look on the servo-library:

pay attention: here you can read:
" Note that servos draw considerable power, so if you need to drive more than one or two, you'll probably need to power them from a separate supply (i.e. not the +5V pin on your Arduino). Be sure to connect the grounds of the Arduino and external power supply together."

if you are not sure how to do that, you can ask again and i try to send you a schematic curcuit diagram...

thnx guys for helping me. GBU!

caltoa: i dont have the code for servo and LM34. if you have the source please tell me. thank you.

The link I gave is to the Servo library.

On the right side of that page, you see two examples.

The LM34 is connected to the 5V and GND, the middle pin to perhaps A0.
http://learn.parallax.com/lm34-temperature-sensor-arduino-demo

Don't start to write the final sketch. Make a sketch to test the servo motors. And another sketch to try the LM34.

You shouldn't pull more than 200 mA of 5V through an UNO, and while the per pin max is 40 mA @ 5V it is better to stick to 20 mA or less. The less current you pull through the board, the better.

Links to often referred to pages on the Arduino site:

Products with many specs on each: Arduino - Products
Foundations, for beginners: http://arduino.cc/en/Tutorial/Foundations
Hacking, for once you've got your stride: http://arduino.cc/en/Hacking/HomePage
The command reference: Arduino - Home
The underlying C/C++ libraries: avr-libc: Modules
The official libraries: Arduino - Libraries
The official Examples, more about those below: http://arduino.cc/en/Hacking/HomePage
The Playground, user contributed: http://playground.arduino.cc/
The Playground, libraries : Arduino Playground - GeneralCodeLibrary

The Example sketches versions that match your IDE come with your IDE. You load them through the File menu.
They are not perfect (like the Playground, it varies) and some teach bad habits (using C++ Strings and like).
Still sections 1, 2, 3 and 5 are mainly all lessons that every Arduino programmer should know about, even with the occasional minor error they run as needed.

If you have code that reads a sensor and other code that moves a motor then don't mix them together. If the sensor picks up a trigger then have that code set a variable that the motor code uses as a signal to run. Do not put the motor code right into the sensor code since
A) it makes the whole harder to debug.
B) it makes the whole harder to change.
C) it makes adding motor triggers harder to do and require more code than setting that variable.
D) it makes the whole harder to read when you do ask for help.

Try to keep the parts that do one thing in one place separated from the rest and pass signals/values between parts. Use the fact that loop() runs when loop() ends to drive your code by events rather than a fixed top-down sequence (what they teach in intro and intermediate PC programming) that's supposed to do everything in one pass. The top-down approach should come with a jar of sauce for all the times it leads to spaghetti.

thnx for your help guys. really appreciate it!