SIK

Hi. i bought the SIK and i was going through the tutorials. i noticed that in the second lesson in the guide, it calls a verbal “sensorPin” and put it in port “0”

the guide tells me to put the pin into “A0”

A0 works and 0 does not. why is this?

the code is posted below:

int sensorPin = 0; // The potentiometer is connected to

// analog pin 0

int ledPin = 10; // The LED is connected to digital pin 13

void setup() // this function runs once when the sketch starts up

{

pinMode(ledPin, OUTPUT);

void loop() // this function runs repeatedly after setup() finishes

sensorValue = analogRead(sensorPin);

digitalWrite(ledPin, HIGH); // Turn the LED on

delay(sensorValue); // Pause for sensorValue

// milliseconds

digitalWrite(ledPin, LOW); // Turn the LED off

delay(sensorValue); // Pause for sensorValue

// milliseconds

The Arduino (or in this case the RedBoard) has different kinds of pins. Some of these pins can sense analog voltages and others cannot. Generally the pins that can sense analog voltage are referenced as A0, A1, A2,… (there may be different amounts of analog pins depending on which board you have).

The rest of the pins are referenced by just a number (generally 0 to 13, again depending on which board.

The pin labels on the Arduino boards correspond to the reference you use in the Arduino IDE. You connected the pot to pin A0 so you should reference it in your program as A0 as well. “0” by itself would reference the digital pin on the other side of the RedBoard.

Clear?

  • Chip

Thats what i thought should happen but in that program it ran on pin A0 but the program just said 0. So you are saying that is because the board could sense that it was an analog input so it knew the program meant A0?

In your first post, you write “A0 works and 0 does not.” That is what I would expect. Are you now saying 0 works?