Selected Courses on Digital Art-UOWM

17 Νοεμβρίου 2014

Arduino13-feely Lamp

Filed under: ARDUINO,NOTES ON INTERACTIVE ART — admin @ 15:24
#include

CapacitiveSensor capSensor = CapacitiveSensor(4,2);

int threshold = 1000;
const int ledPin = 12;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  long sensorValue = capSensor.capacitiveSensor(30);
  Serial.println(sensorValue);

  if(sensorValue > threshold) {
    digitalWrite(ledPin, HIGH);
  }

  else {
    digitalWrite(ledPin, LOW);
  }
  delay(10);
}

Δεν υπάρχουν Σχόλια

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress

error: Content is protected !!