arduino mega超聲波模塊使用

1、接線(不需要串口通信): VCC--VCC GND-GND Tirg-2 Echo-3 2、代碼: const int TrigPin = 2; const int EchoPin = 3; float distance; void setup() { Serial.begin(9600); pinMode(TrigPin, OUTPUT); pinMode(EchoPin, INPUT);
相關文章
相關標籤/搜索