From 6aa7513d24ec6333d253fefb0a52eb5df9042316 Mon Sep 17 00:00:00 2001 From: Aaron Fischer Date: Wed, 24 Dec 2014 16:42:04 +0100 Subject: [PATCH] Add code sample. --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index b94a529..3173e45 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,20 @@ Cherry MX breakout board for Arduino, RaspberryPi and other boards. ![back](/images/v01_back.png) 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)); +} +```