© 2016 by dreamfamily . Proudly created with david hong       홍정수 / jshong@dreamfamily.kr / 010-8295-3427

1일차 소스

int led01= 4;
int led02= 5;
int led03= 6;

void setup() {
pinMode(led01, OUTPUT);
pinMode(led02, OUTPUT);
pinMode(led03, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(led01,HIGH);
delay(1000);
digitalWrite(led01,LOW);
digitalWrite(led02,HIGH);
delay(1000);
digitalWrite(led02,LOW);
digitalWrite(led03,HIGH);
delay(1000);
digitalWrite(led03,LOW);
}

초음파 계산소스

  digitalWrite(tr, LOW);
  delayMicroseconds(2);
  digitalWrite(tr, HIGH);
  delayMicroseconds(10);
  digitalWrite(tr, LOW);
  duration = pulseIn (ec, HIGH);
  distance = duration * 17 / 1000;