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

Untitled

The document contains an Arduino sketch that sets up various pins for input and output, including a setup function and a loop function that repeatedly calls an effect function. The effect function reads digital inputs, controls outputs based on those inputs, and generates tones through a speaker. It also prints the state of the inputs and a flag variable to the serial monitor.
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)
5 views2 pages

Untitled

The document contains an Arduino sketch that sets up various pins for input and output, including a setup function and a loop function that repeatedly calls an effect function. The effect function reads digital inputs, controls outputs based on those inputs, and generates tones through a speaker. It also prints the state of the inputs and a flag variable to the serial monitor.
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;

#include<liquid>

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:


effect();

void effect(){

int g = digitalRead(u);
int i= digitalRead(h);
int s2 = digitalRead(s1);
Serial.println(g);
Serial.println(i);
Serial.println(s2);

noTone(y);
int flag = 0 ;

if( i == 1)
{

digitalWrite(d,HIGH);
tone(y,1750,1000);
flag += 1;

}
else{
digitalWrite(d,LOW);
digitalWrite(y,LOW);

}
if( s2 == 1){

digitalWrite(blue,HIGH);
tone(y,1700,1000);
}

else{
digitalWrite(blue,LOW);
}

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

}
else{
digitalWrite(p,LOW);

tone(y,3500,1000);
}
Serial.print(flag);
Serial.println("hello");

You might also like