Skip to content

Instantly share code, notes, and snippets.

@Kassan424kh
Last active June 26, 2024 10:51
Show Gist options
  • Save Kassan424kh/b345d221c2c951a798a3b6f370ac3a8f to your computer and use it in GitHub Desktop.
Save Kassan424kh/b345d221c2c951a798a3b6f370ac3a8f to your computer and use it in GitHub Desktop.
PC817 optocoupler use as a bush button to turn something on/off using esp32
const int powerButtonPin = 23;
void setup() {
pinMode(powerButtonPin, OUTPUT);
}
void loop() {
digitalWrite(powerButtonPin, HIGH);
delay(1000);
digitalWrite(powerButtonPin, LOW);
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment