Unable to Write to Digital Pins

I'm sure it must be me doing something wrong. But for the life of me I can't write to a digital pin (except the Built in LED.

I'm using a Nano and I'm new to the Ardunio IDE. I've built upon the basic Blink application. The code below, runs and flashes the LED. I know the code is running as I can change the delay length in the code and it changes on the board. I know the pins aren’t’ changing their level as I’m looking at it on a scope/logic analyser.

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(32, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(16, OUTPUT);
  pinMode(15, OUTPUT);
}

// the loop function runs over and over again forever
void loop()
{
  digitalWrite(LED_BUILTIN, HIGH);
  digitalWrite(32, HIGH);
  digitalWrite(1, HIGH);
  digitalWrite(15, HIGH);
  digitalWrite(16, HIGH);
  delay(200);
  digitalWrite(LED_BUILTIN, LOW);
  digitalWrite(32, LOW);
  digitalWrite(1, LOW);
  digitalWrite(15, LOW);
  digitalWrite(16, LOW);
  delay(200);
}

I've tried subsitutue the pin numbers for the pin names (PB4, PB3 etc..) but that doesn't work.

Is there something obvious that I'm missing?

I'm using a Nano

  pinMode(32, OUTPUT);

How many pins does a Nano have?

void loop()
{
  while (1)
  {

loop() loops. Ditch the stupid while statement.

I know the pins aren't' changing their level as I'm looking at it on a scope/logic analyser.

I would suspect that you don't have the scope/logic analyzer connected correctly, then.

Connect an LED, with currently limiting resistor, between the output pin and ground. Does the LED flash?

  pinMode(32, OUTPUT);

Which pin should that be on a Nano?

  pinMode(1, OUTPUT);
  pinMode(16, OUTPUT);
  pinMode(15, OUTPUT);

You checked TX(1), A1(15) and A2(16) ?

But for the life of me I can't write to a digital pin (except the Built in LED.

Are you by any chance trying to use the chip pin numbers rather than the pin numbers printed on the Nano ?

PaulS:

  pinMode(32, OUTPUT);

How many pins does a Nano have?

32 - Pin 32 is (or should be) D2 or PD3

PaulS:

void loop()

{
  while (1)
  {



loop() loops. Ditch the stupid while statement.

PaulS:
Yep - i left the while (1) loop in unintentionally as I was experimenting with soem other stuff. In the above example - I agree it's pointless.

I would suspect that you don't have the scope/logic analyzer connected correctly, then.

Connect an LED, with currently limiting resistor, between the output pin and ground. Does the LED flash?

I'll try

pinMode, digitalWrite and co., take as parameter the pin labels written on the board. there is no pin 1 or 30

Juraj:
pinMode, digitalWrite and co., take as parameter the pin labels written on the board. there is no pin 1 or 30

On a Nano there is a pin 1, pin numbers go from 0 to 20, 19 and 20 are analog input only.

Juraj:
pinMode, digitalWrite and co., take as parameter the pin labels written on the board. there is no pin 1 or 30

Ah ha - that's what I'm doing wrong then

Whandall:
On a Nano there is a pin 1, pin numbers go from 0 to 20, 19 and 20 are analog input only.

as label on the board?

As parameters of pinMode etc. as you know.