docs

a slatepencil documentail site

View on GitHub

Inclination Test

Rotate the board and the led will turn on off

hardware

wire

code

const int sigPin = 7;
const int ledPin = 13;

boolean sigState = 0;
void setup() {
  // put your setup code here, to run once:
  pinMode(ledPin, OUTPUT);
  pinMode(sigPin, INPUT);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  sigState = digitalRead(sigPin);
  Serial.println(sigState);
  if (sigState == HIGH) {
    digitalWrite(ledPin, LOW);
  } else {
    digitalWrite(ledPin, HIGH);
  }
}