Pin 0 stays high on Arduino Uno

Hello All,

I'm finishing a light wand for use with light painting. The hardware is working to specs, but for some reason pin0 stays high regardless of instructions otherwise.

Here is the prototype code:

//define pinled(X); int pinled1 = 1; int pinled2 = 2; int pinled3 = 3; int pinled4 = 4; int pinled5 = 5; int pinled6 = 6; int pinled7 = 7; int pinled8 = 8; int pinled9 = 9; int pinled10 = 10; int pinled11 = 11; int pinled12 = 12; int pinled13 = 13; int pinled14 = 14;

int analogled15 = A0; int analogled16 = A1;

int timeoff = 100; int timeon = 50;

void setup() { //set pins as outputs; pinMode(pinled1,OUTPUT); pinMode(pinled2,OUTPUT); pinMode(pinled3,OUTPUT); pinMode(pinled4,OUTPUT); pinMode(pinled5,OUTPUT); pinMode(pinled6,OUTPUT); pinMode(pinled7,OUTPUT); pinMode(pinled8,OUTPUT); pinMode(pinled9,OUTPUT); pinMode(pinled10,OUTPUT); pinMode(pinled11,OUTPUT); pinMode(pinled12,OUTPUT); pinMode(pinled13,OUTPUT); pinMode(pinled14,OUTPUT);

}

void loop() {

analogWrite(analogled15, 0); //set analogled's to 0 analogWrite(analogled16, 0);

//init delay; //delay(1000);

//frame A digitalWrite(pinled1,HIGH); //digital frame on digitalWrite(pinled2,HIGH); digitalWrite(pinled3,HIGH); digitalWrite(pinled4,HIGH); digitalWrite(pinled5,HIGH); digitalWrite(pinled6,HIGH); digitalWrite(pinled7,HIGH); digitalWrite(pinled8,HIGH); digitalWrite(pinled9,HIGH); digitalWrite(pinled10,HIGH); digitalWrite(pinled11,HIGH); digitalWrite(pinled12,HIGH); digitalWrite(pinled13,HIGH); digitalWrite(pinled14,HIGH);

analogWrite(analogled15, 255); //analog frame on analogWrite(analogled16, 255);

delay(timeon);

digitalWrite(pinled1,LOW); //digital frame off digitalWrite(pinled2,LOW); digitalWrite(pinled3,LOW); digitalWrite(pinled4,LOW); digitalWrite(pinled5,LOW); digitalWrite(pinled6,LOW); digitalWrite(pinled7,LOW); digitalWrite(pinled8,LOW); digitalWrite(pinled9,LOW); digitalWrite(pinled10,LOW); digitalWrite(pinled11,LOW); digitalWrite(pinled12,LOW); digitalWrite(pinled13,LOW); digitalWrite(pinled14,LOW);

analogWrite(analogled15, 0); //analog frame off analogWrite(analogled16, 0);

delay(timeoff);

}

There are 14 LED's connected to the digital pins. 2 LED's are connected to analog pins 0 and 1. Only pin0 is having troubles. If I can solve this without having to utilize other digital pins (IE 1-14), I would prefer to do so. I have already completed the connection header based on digital pins 0-13.

I have tried unplugging the LED header from the TX/RX pins during upload, with no effect.

Any help would be appreciated boku.

pixelize

You never define anything using pin 0, just pin 1. Also, the analog pins (A0, A1, etc) are analog inputs, not outputs. The pins with a ~ by them are PWM (essentially analog) outputs.

Thank you. You are absolutely right. I defined pins 1-14, instead of pins 1-13. SUCCESS!! It's working now.

As far as the analog, I have 2 led's connected to pins A0 and A1. I have never used analog pins before. I was unsure how to set them as inputs or outputs, so I tried just using the analogWrite command for them. Whether or not I am not using them correctly, they are working now. Can you recommended a better way to call on/off values for LED's connected to analog pins?

EDIT ** I defined pins 1-14, instead of pins 01-13. **

pins 0-13. Sorry, multi-tasking right now.