🕌
アルディーノメモ(2024/10/8)
PUSH SWITCHESを使って、ボタンを押すとLEDが点滅
int ledPin = 5;
int buttonApin = 9;
int buttonBpin = 8;
@[gist]()
byte leds = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(buttonApin, INPUT_PULLUP);
pinMode(buttonBpin, INPUT_PULLUP);
}
void loop()
{
if (digitalRead(buttonApin) == LOW)
{
digitalWrite(ledPin, HIGH);
}
if (digitalRead(buttonBpin) == LOW)
{
digitalWrite(ledPin, LOW);
}
}
Discussion