Using D0 and D1

Hi,

I am finding that pins D0 and D1, which double up as RX and TX do not go LOW when instructed do so so.

Presumably they can be used to do so, or they would not be part of the input/output.

Can anyone tell me how to do this please?

Chris.

Did you make a pinMode call to set them to be outputs? It would help if you posted your code.

Hi,.

Thanks - Yes I did. Code below:

Thanks,

Chris

void setup() {
Serial.begin(13600);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(6,OUTPUT);
pinMode(6,OUTPUT);
pinMode(5,OUTPUT);
pinMode(4,OUTPUT);
pinMode(3,OUTPUT);
pinMode(2,OUTPUT);
pinMode(1,OUTPUT);
pinMode(0,OUTPUT);
}

void loop() {
int units=0;
int tens=0;
int counter=0;
while (counter < 100)
{
tens=int(counter/10);
units=counter-10*tens;
if (units==0)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
digitalWrite(9,HIGH);
digitalWrite(8,HIGH);
digitalWrite(7,LOW);
}
if (units==1)
{
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
}
if (units==2)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
digitalWrite(10,HIGH);
digitalWrite(9,HIGH);
digitalWrite(8,LOW);
digitalWrite(7,HIGH);
}
if (units==3)
{
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
digitalWrite(9,HIGH);
digitalWrite(8,LOW);
digitalWrite(7,HIGH);
}
if (units==4)
{
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
digitalWrite(9,LOW);
digitalWrite(8,HIGH);
digitalWrite(7,HIGH);
}
if (units==5)
{
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
digitalWrite(9,HIGH);
digitalWrite(8,HIGH);
digitalWrite(7,HIGH);
}
if (units==6)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
digitalWrite(9,HIGH);
digitalWrite(8,HIGH);
digitalWrite(7,HIGH);
}
if (units==7)
{
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
digitalWrite(9,HIGH);
digitalWrite(8,LOW);
digitalWrite(7,LOW);
}
if (units==8)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
digitalWrite(9,HIGH);
digitalWrite(8,HIGH);
digitalWrite(7,HIGH);
}
if (units==9)
{
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
digitalWrite(9,HIGH);
digitalWrite(8,HIGH);
digitalWrite(7,HIGH);
}
if (tens==0)
{
digitalWrite(2,HIGH);
digitalWrite(1,HIGH);
digitalWrite(0,HIGH);
digitalWrite(6,HIGH);
digitalWrite(5,HIGH);
digitalWrite(4,HIGH);
digitalWrite(3,LOW);
}
if (tens==1)
{
digitalWrite(2,LOW);
digitalWrite(1,LOW);
digitalWrite(0,HIGH);
digitalWrite(6,HIGH);
digitalWrite(5,LOW);
digitalWrite(4,LOW);
digitalWrite(3,LOW);
}
if (tens==2)
{
digitalWrite(2,HIGH);
digitalWrite(1,HIGH);
digitalWrite(0,LOW);
digitalWrite(6,HIGH);
digitalWrite(5,HIGH);
digitalWrite(4,LOW);
digitalWrite(3,HIGH);
}
if (tens==3)
{
digitalWrite(2,LOW);
digitalWrite(1,HIGH);
digitalWrite(0,HIGH);
digitalWrite(6,HIGH);
digitalWrite(5,HIGH);
digitalWrite(4,LOW);
digitalWrite(3,HIGH);
}
if (tens==4)
{
digitalWrite(2,LOW);
digitalWrite(1,LOW);
digitalWrite(0,HIGH);
digitalWrite(6,HIGH);
digitalWrite(5,LOW);
digitalWrite(4,HIGH);
digitalWrite(3,HIGH);
}
if (tens==5)
{
digitalWrite(2,LOW);
digitalWrite(1,HIGH);
digitalWrite(0,HIGH);
digitalWrite(6,LOW);
digitalWrite(5,HIGH);
digitalWrite(4,HIGH);
digitalWrite(3,HIGH);
}
if (tens==6)
{
digitalWrite(2,HIGH);
digitalWrite(1,HIGH);
digitalWrite(0,HIGH);
digitalWrite(6,LOW);
digitalWrite(5,HIGH);
digitalWrite(4,HIGH);
digitalWrite(3,HIGH);
}
if (tens==7)
{
digitalWrite(2,LOW);
digitalWrite(1,LOW);
digitalWrite(0,HIGH);
digitalWrite(6,HIGH);
digitalWrite(5,HIGH);
digitalWrite(4,LOW);
digitalWrite(3,LOW);
}
if (tens==8)
{
digitalWrite(2,HIGH);
digitalWrite(1,HIGH);
digitalWrite(0,HIGH);
digitalWrite(6,HIGH);
digitalWrite(5,HIGH);
digitalWrite(4,HIGH);
digitalWrite(3,HIGH);
}
if (tens==9)
{
digitalWrite(2,LOW);
digitalWrite(1,LOW);
digitalWrite(0,HIGH);
digitalWrite(6,HIGH);
digitalWrite(5,HIGH);
digitalWrite(4,HIGH);
digitalWrite(3,HIGH);
}
counter=counter+1;
if (counter==100) counter=0;
delay (500);
}
}

Code below:

Please edit your post, select the code, and put it between [code][/code] tags.

You can do that by hitting the # button above the posting area.

As explained in the sticky, which I hope you read:

Read this before posting a programming question

As for your issue, there are pull-ups between the USB interface chip and the Atmega328 which probably accounts for what you are seeing.

if (units==0)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
digitalWrite(9,HIGH);
digitalWrite(8,HIGH);
digitalWrite(7,LOW);
}
if (units==1)
...

You may want to look up how to use arrays. This would be incredibly difficult to maintain.

 Serial.begin(13600);

You are starting Serial, then trying to manipulate the pins it uses.

Thank you - that's great :)

In other words, remove the Serial.begin() call.