2023年9月23日 星期六

Arduino 簡易訊號偵測,紅外線拼接

 void setup() {

  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(5,INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(100); //延遲毫秒
  if(digitalRead(5)==0) //0=LOW
  // If no signal print collision detected
  Serial.println("Balls");
  if(digitalRead(5)==1) //1=HIGH
  //else
  // 11 If signal detected print collision detected
  Serial.println("No Balls.");
}

沒有留言:

張貼留言

GOOGLE不小心按了改成韓文,改變語言設定

  好奇點了上面的其他語言版本,結果搞了一會才改回中文,提供修改流程給需要的人