Senin, 28 Juli 2014

Koneksi LDR arduino uno r3

Koneksi LDR

int LDRValue = 0;
int LDRPort = 0;
int light_sensitivity = 500;

void setup() {
  // put your setup code here, to run once:
  pinMode(13, OUTPUT);
  Serial.begin( 9600 );
}

void loop() {
  // put your main code here, to run repeatedly:
  LDRValue = analogRead(LDRPort);
  Serial.println(LDRValue);
  if (LDRValue < 500)
    digitalWrite(13, HIGH);
  else
    digitalWrite(13, LOW);
  //delay(1000);
}

Tidak ada komentar:

Posting Komentar