How does this work?

int speakerPin = A3;

How does this code work>
doesnt INT mean interger?
I know it is saying analog pin 3… but that is not a number right?

1 Like

Hi there,
Yes, makes “speakerPin” equivalent or equal to the “A3 PIN”
it is a number after you do that. it so you can say “Speaker pin” in your code and it works even if the pin is changed elsewhere or redefined do to new hardware.
I could hook up any Analog PIN as the “speakerPin” so code will work even if you pick another pin is all.
the point is you have a way to Identify what the resource is connected to PIN wise.
GL :slight_smile: PJ
:v:

Hi there,
Here is A great set of video’s on the many interfaces available.

HTH
GL :slight_smile: PJ
:v:

I used these when laying out some PC boards. lots of good info in there. :+1:

OH! i understand now … so what you are saying is “int speakerPin = A3;”

Hi there,
Go look here, LOTS of basic guides to boost your Arduino MOJO…
https://docs.arduino.cc/learn/
HTH
GL :slight_smile: PJ
:v:

this one is most helpful IMO for making and understanding LIB’s
https://docs.arduino.cc/learn/contributions/arduino-library-style-guide/

https://docs.arduino.cc/learn/programming/reference