Home » Articles » Сорс код

Laser Alarm (code)

int buzzer=9;
int photocell=A0;
int sensorValue=0;


void setup(){
  pinMode(buzzer, OUTPUT);
 Serial.begin(9600);   
  pinMode(13, OUTPUT);
  pinMode(photocell, INPUT);
  digitalWrite(13, HIGH);
}

void loop(){
  sensorValue=analogRead(photocell);
  Serial.println(sensorValue);
  if(sensorValue<1){digitalWrite(9, HIGH); digitalWrite(13, HIGH);}
 
  else {digitalWrite(13, LOW); digitalWrite(9, LOW);}
}

Category: Сорс код | Added by: MilenTsolov (2016-02-23)
Views: 181 | Rating: 0.0/0
Total comments: 0
avatar