'2) Sensor/Photo_Interrupter'에 해당되는 글 1건

  1. 2016.09.09 Photo Interrupter Module (KY-010) [S041]

Photo Interrupter Module (KY-010) [S041]



https://www.youtube.com/watch?v=J3O2_PgEOBI


*GitHubhttps://github.com/rdiot/rdiot-s041.git


* Specs

Photo interupter module use the buildin arduino led. If the sensor is broken the LED is turned on.

Device senses a signal, LED lights, otherwise off.


* Contents

- Connect

S ----- D2

Middle ----- 5V

G ----- GND


- Key Code

int pin = 2;


void loop()

{

  int val = digitalRead(pin);

  Serial.println("digital=" + (String)val + " ");


  if(HIGH == val)

  {

    Serial.println("interrupt=detected---------------------------------------------------------");

    delay(100);

  }

  else{

    Serial.println("interrupt=NONE   ");

    delay(100);

  }

}



'2) Sensor > Photo_Interrupter' 카테고리의 다른 글

Photo Interrupter Module (KY-010) [S041]  (0) 2016.09.09
Posted by RD IoT RDIoT

댓글을 달아 주세요