0% found this document useful (0 votes)
3 views6 pages

sgn

The document contains multiple C and Arduino code snippets for reading input values and controlling outputs based on conditions. It includes functions for reading integers, setting up pins, and controlling LEDs and buzzers based on button states and potentiometer values. There are several repetitive sections that implement similar functionality for different hardware configurations.

Uploaded by

Shashank Gowda
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)
3 views6 pages

sgn

The document contains multiple C and Arduino code snippets for reading input values and controlling outputs based on conditions. It includes functions for reading integers, setting up pins, and controlling LEDs and buzzers based on button states and potentiometer values. There are several repetitive sections that implement similar functionality for different hardware configurations.

Uploaded by

Shashank Gowda
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/ 6

// Online C compiler to run C program online

#include <stdio.h>
int k;
void shr(){
scanf("%d",&k);}
void ndh(){
printf("sgn");}

int main() {
shr();
if (k>0){
ndh();
}

return 0;
}
#include <stdio.h>
int k;
int main(){

scanf("%d",&k);

if(k==1){
printf("ok");
}
else{
printf("try again");
}

int button = 9;
int led = 12;
bool state = false;

void setup(){
// put your setup code here, to run once:
pinMode(12,OUTPUT);
pinMode(7,OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
state = digitalRead (button );
if(state == HIGH){
digitalWrite(12, HIGH);
delay(1000);}
else
digitalWrite(12,LOW);

}
int button = 9;
int led = 12;
bool state = false;

void setup(){
// put your setup code here, to run once:
pinMode(12,OUTPUT);
pinMode(7,OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
state = digitalRead (button );
if(state == HIGH){
digitalWrite(12, HIGH);
delay(1000);}
else
digitalWrite(12,LOW);

}
int button = 9;
int led = 12;
bool state = false;

void setup(){
// put your setup code here, to run once:
pinMode(12,OUTPUT);
pinMode(7,OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
state = digitalRead (button );
if(state == HIGH){
digitalWrite(12, HIGH);
delay(1000);}
else
digitalWrite(12,LOW);

}
int button = 9;
int led = 12;
bool state = false;

void setup(){
// put your setup code here, to run once:
pinMode(12,OUTPUT);
pinMode(7,OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
state = digitalRead (button );
if(state == HIGH){
digitalWrite(12, HIGH);
delay(1000);}
else
digitalWrite(12,LOW);
}
int button = 9;
int led = 12;
bool state = false;

void setup(){
// put your setup code here, to run once:
pinMode(12,OUTPUT);
pinMode(7,OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
state = digitalRead (button );
if(state == HIGH){
digitalWrite(12, HIGH);
delay(1000);}
else
digitalWrite(12,LOW);

}
int button = 9;
int led = 12;
bool state = false;

void setup(){
// put your setup code here, to run once:
pinMode(12,OUTPUT);
pinMode(7,OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
state = digitalRead (button );
if(state == HIGH){
digitalWrite(12, HIGH);
delay(1000);}
else
digitalWrite(12,LOW);

}
int button = 9;
int led = 12;
bool state = false;

void setup(){
// put your setup code here, to run once:
pinMode(12,OUTPUT);
pinMode(7,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
state = digitalRead (button );
if(state == HIGH){
digitalWrite(12, HIGH);
delay(1000);}
else
digitalWrite(12,LOW);

}
int button = 9;
int led = 12;
bool state = false;

void setup(){
// put your setup code here, to run once:
pinMode(12,OUTPUT);
pinMode(7,OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
state = digitalRead (button );
if(state == HIGH){
digitalWrite(12, HIGH);
delay(1000);}
else
digitalWrite(12,LOW);

}
int button = 9;
int led = 12;
bool state = false;

void setup(){
// put your setup code here, to run once:
pinMode(12,OUTPUT);
pinMode(7,OUTPUT);

void loop() {
// put your main code here, to run repeatedly:
state = digitalRead (button );
if(state == HIGH){
digitalWrite(12, HIGH);
delay(1000);}
else
digitalWrite(12,LOW);
}

scanf("%d",&k);

if(k==1){
printf("ok");
}
else{
printf("try again");
}
return 0;

int pot = A1;


int led = 3;
int buz = 7;
int turn = 5;

void setup() {
pinMode(led,OUTPUT);
pinMode(buz,OUTPUT);
pinMode(turn,OUTPUT);
}

void loop(){
int potvalue = analogRead(pot);

int bright = map(0,1023,0,225,potvalue);


analogWrite(led,bright);
int SOUND = map(0,1023,0,225,potvalue);
analogWrite(buz,SOUND);
int ROT = map(0,1023,0,225,potvalue);
analogWrite(turn,ROT);
}

int pot = A1;


int led = 3;
int buz = 7;
int turn = 5;
int you = 10;

void setup() {
pinMode(led,OUTPUT);
pinMode(buz,OUTPUT);
pinMode(turn,OUTPUT);
}

void loop(){
int potvalue = analogRead(pot);

int bright = map(0,1023,0,225,potvalue);


analogWrite(led,bright);
int SOUND = map(0,1023,0,225,potvalue);
analogWrite(buz,SOUND);
int ROT = map(0,1023,0,225,potvalue);
analogWrite(turn,ROT);
int rog = map(0,1023,0,225,potvalue);
analogWrite(you,rog);
}

You might also like