blackbook1
blackbook2
blackbook3
blackbook4
blackbook5
blackbook6
blackbook7
blackbook8
blackbook9
blackbook10
blackbook2
blackbook3
blackbook4
blackbook5
blackbook6
blackbook7
blackbook8
blackbook9
blackbook10
int sensorValue = 0;
int tmp=0;
int val=0; // variable to read the value from the analog pin
int buttonState1 = LOW;
int buttonState2 = LOW;
int buttonState2 = LOW;
void setup()
{
pinMode(14, INPUT);
pinMode(15, INPUT);
pinMode(16, INPUT);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
tmp=analogRead(A3);
for(i=0;i<1000;i++)
{
sensorValue = analogRead(A3);
tmp=(tmp+sensorValue)/2;
}
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
void loop()
{
sensorValue = analogRead(A3);
val=abs(round((tmp-sensorValue)/3));
buttonState1 = digitalRead(14);
buttonState2 = digitalRead(15);
buttonState3 = digitalRead(16);
if(val>10)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
}
if(buttonState1 == HIGH)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
}
if(buttonState2 == HIGH)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
}
if(buttonState3 == HIGH)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
}
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
}
int tmp=0;
int val=0; // variable to read the value from the analog pin
int buttonState1 = LOW;
int buttonState2 = LOW;
int buttonState2 = LOW;
void setup()
{
pinMode(14, INPUT);
pinMode(15, INPUT);
pinMode(16, INPUT);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
tmp=analogRead(A3);
for(i=0;i<1000;i++)
{
sensorValue = analogRead(A3);
tmp=(tmp+sensorValue)/2;
}
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
void loop()
{
sensorValue = analogRead(A3);
val=abs(round((tmp-sensorValue)/3));
buttonState1 = digitalRead(14);
buttonState2 = digitalRead(15);
buttonState3 = digitalRead(16);
if(val>10)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
}
if(buttonState1 == HIGH)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
}
if(buttonState2 == HIGH)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
}
if(buttonState3 == HIGH)
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
}
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
}
Circuit diagram:-