defining analog pins

with digital pins you have to define which pin does what like

int buzzPin = 11; // a piezo buzzer connected to digital pin 11

why dont you do this for Analog Pins?

im looking to do somthing similar to this:

but i dont understand why you dont have to define what the analog pins do.... is it becuase they can only read analog inputs?

so do you not define it because you just tell the arduino to "analogRead(0)" which tells the arduino to read input from Analog In "A0"?

Thanks a bunch dude. I actually noodled around the Forum and confirmed my question, but thank you so much for the super quick reply.

sigh

now, to actually get an Arduino...i dont have one, but with all the research i have done i should be all set to go once i get one lol.

Remember that to use analogWrite() you must declare the pin as output.

You do?

The "man page"

Who reads man pages,when you've got the source code? :slight_smile:

@moogbeatz99,
You can take the innovators approach to getting an arduino:
Buy a bootloaded ATMega328,
16 MHz crystal, two 22 pF caps, three 100nF caps, 10K resistor and a 28 pin socket, piece of male header strip and a protoboard from www.dipmicro.com, and a FTDI-Basic from www.gravitech.us for downloading sketches, and just build up your own.
Maybe add a 40-pin female header with the 20 IO signals (D0-D13, A0-A5 (a.k.a. D14-D19)) and some power/grounds, maybe reset if you need it.
5V/2A power adapter to power it, plug into a 5.5mm/2.1 panel mount power jack from www.mpja.com or partsexpress.com
5.5mm - 2.1mm Coax Power Jack - Panel Mount
if you don't want to cut the end of the power cord.
I think all can be had for less than an arduino, and you get the fun of building it up also.
Then add option like a power LED with 10K resistor, a "D13" LED with 1K resistor if you want an activity indicator.

Really, just basically build up the cirtuit of a Promini. Piece of cake.

thanks for the advice dude. i may eventually make one for a permanent installation of something i make, but my birthday is legit today, so i think my parents may have bought me the sparkfun starter kit.

The reason for defining a name for a pin with #define has nothing to do with it being an input or an output or analog or digital or even being a pin.

The point is that good programming practice is to never put arbitrary hard-coded numbers into code when those numbers are not universally fixed. Here we have code using an arduino pin. Some people might want to use one pin, some people another pin. Rather than have to hunt through the actual code to find which pin numbers to change you just have to rewrite a few #defines. The code just refers to the pin by name.

Ideally these #defines ought to be in a header (.h) file to further separate code from configuration data...

That instructables code is just a bit sloppy, that's all.

That instructables code is a pretty nasty example to put out.
My favourite bit:

Serial.println(int(Thermister(analogRead(0)))); // display Fahrenheit

lcd.print(int(Thermister(analogRead(0))));

lcd.print(" degress [sic] C");

:fearful: