//// write a progrom to on and off led using button
/// 12221263
void setup() {
// put your setup code here, to run once:
pinMode(2, OUTPUT);
pinMode(33, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(33) == HIGH) {
digitalWrite(2, HIGH);
delay(500);
} else {
digitalWrite(2, LOW);
delay(500);
}
}
//// write a progrom to control the brightness of led connected to gpio2 of esp32
/// 12221263
// void setup() {
// // put your setup code here, to run once:
// pinMode(2, OUTPUT);
// }
// void loop() {
// // put your main code here, to run repeatedly:
// for(int i = 0; i < 255; i++) {
// analogWrite(2, i);
// delay(5);
// }
// for(int i = 255; i >= 0; i--) {
// analogWrite(2, i);
// delay(5);
// }
// }
//// write an program to control the brigtness of an led wrt knob position of potentiometer
/// led is connected to gpio2 potientiometer is connected to gpio32
// void setup() {
// // put your setup code here, to run once:
// Serial.begin(9600);
// pinMode(2, OUTPUT);
// }
// void loop() {
// // put your main code here, to run repeatedly:
// int brig = analogRead(32) / 16;
// Serial.print("brightness: ");
// Serial.println(brig);
// analogWrite(2, brig);
// }