arduino / arduino/ArduinoCore-avr

SPI library examples whould use & explain pre-defined pin constants: MOSI, MISO, SCK, SS [imported]

Open
#219 1 comment 0 reactions 1 assignee Claimed by @cmaglie View on GitHub
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

This is [Issue 750](http://code.google.com/p/arduino/issues/detail?id=750) moved from a Google Code project.
Added by 2011-12-14T20:35:06.000Z by [paul.sto...@gmail.com](http://code.google.com/u/102276914943260257800/).
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Enhancement, Priority-Medium, Component-Examples
### Original description

**What change would like to see?**

The SPI library examples should explain (and use) the pre-defined pin number constants MOSI, MISO, SCK, SS. Well, at least SS should be used on DigitalPotControl, instead of hard-coding pin 10.

**Why?**

Documenting and encouraging use of these constants will promote a coding style that makes sketches and liraries compatible with boards other than Uno.

Many sketches exist which will not work on Mega, and probably will not work on Due, Leonardo and other future boards, as well as 3rd party boards with different pinouts. Often authors will create their own #define statements for the SPI pins, because they are unaware that the core provides them automatically!

**Would this cause any incompatibilities with previous versions? If so, how**
**can these be mitigated?**

No incompatibilities. Long term, this change should greatly improve compatibility.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.