Senin, 28 Juli 2014

Alerem menggunakan LDR Dan Bluetooth Arduino uno r3

Alerem menggunakan LDR Dan Bluetooth 
Harus control dengan android bluetem

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);
    Serial.println("Ada maling");
  }
  else {
    digitalWrite(13, LOW);
    Serial.println("Aman");
  }
  //delay(1000);
}

Tidak ada komentar:

Posting Komentar