0% found this document useful (0 votes)
2 views2 pages

Bomb

The document is an Arduino sketch that sets up various pins for input and output, initializes serial communication, and continuously reads input states in the loop function. It controls the state of several output pins based on the readings from input pins and generates tones using the tone function. The logic includes conditions for turning on/off LEDs and generating sounds based on sensor inputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Bomb

The document is an Arduino sketch that sets up various pins for input and output, initializes serial communication, and continuously reads input states in the loop function. It controls the state of several output pins based on the readings from input pins and generates tones using the tone function. The logic includes conditions for turning on/off LEDs and generating sounds based on sensor inputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

int p = 3;

int u = 12;
int y = 9;
int h = 11;
int d = 7;
int blue = 8;
int s1= 2;
int flag = 0;

void setup() {
// put your setup code here, to run once:
pinMode(p,OUTPUT);
pinMode(y,OUTPUT);
pinMode(u,INPUT);
pinMode(h,INPUT);
pinMode(d,OUTPUT);
pinMode(blue,OUTPUT);
pinMode(s1,INPUT);
Serial.begin(9600);

void loop() {

// put your main code here, to run repeatedly:


int g = digitalRead(u);
int i= digitalRead(h);
int s2 = digitalRead(s1);
Serial.println(g);
Serial.println(i);
tone(y,100000,1000);

if( i == 1){
digitalWrite(d,HIGH);
tone(y,1000,1000);
flag = 2;

}
else{
digitalWrite(d,LOW);
digitalWrite(y,LOW);
flag = 0;

}
if( s2 == 1){
digitalWrite(blue,HIGH);
tone(y,1,1000);

}
else{
digitalWrite(blue,LOW);
}

if( g == 0){
digitalWrite(p,HIGH);
digitalWrite(y,HIGH);

}
else{
digitalWrite(p,LOW);
digitalWrite(y,LOW);
tone(y,100,100);

You might also like