本帖最后由 跋扈 于 2020-9-28 09:01 编辑
#define key 0#define led 16
volatile int state =LOW;
void setup()
{
pinMode(led,OUTPUT);
pinMode(key,INPUT);
digitalWrite(led,LOW);
attachInterrupt(key,stateChange,CHANGE);
}
void stateChange()
{
state=!state;
digitalWrite(led,state);
}
void loop()
{
}
|
|
|
|
|
|