티스토리 뷰
Ref: https://roboticsbackend.com/arduino-input_pullup-pinmode/
Code
const int BUTTON = 2;
int BUTTONstate = 0;
void setup()
{
Serial.begin(9600);
pinMode(BUTTON, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
Serial.println(digitalRead(BUTTON));
BUTTONstate = digitalRead(BUTTON);
if (BUTTONstate == HIGH)
{
digitalWrite(LED_BUILTIN, HIGH);
}
else{
digitalWrite(LED_BUILTIN, LOW);
}
}
'IT' 카테고리의 다른 글
Use tab key in Power Automate (0) | 2023.10.20 |
---|---|
Shortcut for Edge profile with custom icon (1) | 2023.10.16 |
Airtable Connector Support (23) | 2021.06.15 |
MS Certificates (0) | 2021.01.10 |
If I want to buy some gaming stuff (0) | 2020.12.16 |
댓글