Add code sample.
This commit is contained in:
parent
2b9c078acf
commit
6aa7513d24
1 changed files with 17 additions and 0 deletions
17
README.md
17
README.md
|
@ -7,3 +7,20 @@ Cherry MX breakout board for Arduino, RaspberryPi and other boards.
|
||||||
![back](/images/v01_back.png)
|
![back](/images/v01_back.png)
|
||||||
|
|
||||||
Order here: https://oshpark.com/shared_projects/PogDjaIS
|
Order here: https://oshpark.com/shared_projects/PogDjaIS
|
||||||
|
|
||||||
|
```arduino
|
||||||
|
const int buttonPin = 10;
|
||||||
|
const int ledPin = 11;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
pinMode(buttonPin, INPUT);
|
||||||
|
pinMode(ledPin, OUTPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// The switches are equiped with pull-down resistors. So if the
|
||||||
|
// button is pressed, you read a HIGH, if the button is released
|
||||||
|
// you read a LOW.
|
||||||
|
digitalWrite(ledPin, digitalRead(buttonPin));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue