Skip to content

Vickyyyyy/123

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

#define sensorPin A0 #define buzzer_pin 6 //定义蜂鸣器驱动引脚 #define buzzer_fre 600 //定义蜂鸣器输出频率 int state;

void setup() { pinMode(sensorPin, INPUT); pinMode(buzzer_pin,OUTPUT); Serial.begin(9600); } void loop() { state = analogRead(sensorPin); Serial.print("state:"); Serial.println(state); delay(10); if(state>300) { tone(buzzer_pin,buzzer_fre); //驱动蜂鸣器
} else { noTone(buzzer_pin); } }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published