Skip to content

Using fake pin number #6207

Closed
Closed
@FernandoGarcia

Description

@FernandoGarcia

Hi!

I haven't enough pins in my controller and I need use some fake pin numbers to allow user select the right pin desired if not using a multiplexer.

The problem is that using the pin number as 86 for Arduino Mega the code change pin status of pins 10, 11 or 12.

Here the test code:

void setup() 
{
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(86, OUTPUT);
}
void loop() 
{
  digitalWrite(9, HIGH);
  digitalWrite(10, HIGH); 
  digitalWrite(11, HIGH); 
  digitalWrite(12, HIGH);
  delay(1000);            
  digitalWrite(86, LOW); 
  delay(1000);              
}

For this example only the LED on pin 11 is blinking but in my big code I have pins 10 and 12 blinking too.
I think that Arduino core should have a function to ignore wrong pin number to prevent strange behavior when user has wrong pin signed on code.

Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Architecture: AVRApplies only to the AVR microcontrollers (Uno, etc.)Type: DuplicateAnother item already exists for this topic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions