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.");
}
沒有留言:
張貼留言