---
# System prepended metadata

title: Untitled

---

#閃燈
```javascript=


#void setup()``
{
  pinMode( D4 , OUTPUT);
}

void loop()
{
  digitalWrite(D4 , LOW);
  delay( 1000 );
  digitalWrite(D4 , HIGH);
  delay( 1000 );
}
```




#超音波
```javascript=


#include <Ultrasonic2.h>

int Range = 0 ;
Ultrasonic2 monUltrasonic_pin5(5);

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Range = monUltrasonic_pin5.mesurer(6) ;
  Serial.print("Distance=");
  Serial.print(Range);
  Serial.print(" ");
  Serial.println();
  delay( 200 );
}
```

```javascript=





#蜂鳴器
void setup()
{
}

void loop()
{
  tone(D4, 440);
  delay( 1000 );
  noTone(D4);
}
```




```javascript=


#紅外線
int Range = 0 ;
boolean __ardublockDigitalRead(int pinNumber)
{
  pinMode(pinNumber, INPUT);
  return digitalRead(pinNumber);
}



void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Range = __ardublockDigitalRead(D2) ;
  Serial.print("Distance=");
  Serial.print(Range);
  Serial.print(" ");
  Serial.println();
  delay( 200 );
}

```

#圖片
![](https://i.imgur.com/PIVAJ41.jpg)
![](https://i.imgur.com/zOxmmmE.jpg)
![](https://i.imgur.com/onAx5VO.jpg)
![](https://i.imgur.com/HImmua0.jpg)
![](https://i.imgur.com/uNX6Hss.jpg)
![](https://i.imgur.com/t1eCH8B.jpg)
![](https://i.imgur.com/iZ5mK9T.jpg)
![](https://i.imgur.com/WwblJMq.jpg)



























