Out of range pin numbers - do they do anything bad?

Status
Not open for further replies.

Dozer

Member
If I do this:
Code:
pinMode(100, OUTPUT);
or
Code:
digitalWrite(-1, HIGH);
does anything bad happen? It appears to work fine.
 
On Teensy, these functions do nothing when an out-of-range pin number is used.

If your program might ever be used on an official Arduino board, or some non-Teensy board that uses the core library published by Arduino, you might want to avoid this. Arduino's code does not properly check for out-of-range pin numbers.
 
Great! These are for my X-Plane interfacing classes, so it's very unlikely they'll be portable to Arduino without a struggle anyway. I'll put a note in the source to inform future generations to add a slew of new class constructors if they want to try anything like that.
 
Status
Not open for further replies.
Back
Top