OCTOLUMINO

IMG_2928
IMG_2937


IMG_2939

IMG_2940

IMG_2942

int ldr1 = A0;
int ldr2 = A1;
int led1 = 9;
int led2 = 8;
int ldr1Value;
int ldr2Value;

void setup()  {
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(ldr1, INPUT);
  pinMode(ldr2, INPUT);
  Serial.begin(9600);
  }

void loop()  {
ldr1Value = analogRead(ldr1);
ldr2Value = analogRead(ldr2);
//ldr1ValueMap = map(ldr1Value,0,1024,0,255);
//ldr2ValueMap = map(ldr2Value, 0,1024,0,255);

Serial.print("ldr1Value =");
Serial.print(ldr1Value);
Serial.print("\t");
Serial.print("ldr2Value =");
Serial.println(ldr2Value);

if (ldr1Value > 100 && ldr2Value > 10){
  digitalWrite(led1, HIGH);
  digitalWrite(led2, HIGH);
}

if (ldr1Value < 100 && ldr2Value > 10){
  digitalWrite(led1, LOW);
  digitalWrite(led2, LOW);
}

if (ldr1Value > 100 && ldr2Value < 10){
  digitalWrite(led1, LOW);
  digitalWrite(led2, LOW);
}

if (ldr1Value < 100 && ldr2Value < 10){
  digitalWrite(led1, LOW);
  digitalWrite(led2, LOW);
}

delay(10);
}