Other Arduino Codes and Videos by Robojax

Arduino code and video for Sharp IR distance module Robojax.com

This is the Arduino code and video for Sharp Infrared Sensor Module

This video shows you how to measure the distance between 4cm to 180cm depending on the module, using Arduino. Sharp Analog output modules:
  1. Distance Measuring Sensors (Website)
  2. Sharp IR Library (from Robojax.com)
  3. Sharp IR Library (from getHub)

 * Sharp IR (infrared) distance measurement module for Arduino
 * Measures the distance in cm.

 * Watch the video https://youtu.be/GL8dkw1NbMc

 *  * 

Original library: https://github.com/guillaume-rico/SharpIR

Updated by by Ahmad Nejrabi for Robojax.com
on Feb 03, 2018 at 07:34 in Ajax, Ontario, Canada
 * Permission granted to share this code given that this
 * note is kept with the code.
 * Disclaimer: this code is "AS IS" and for educational purpose only.

  // Sharp IR code for Robojax.com
#define DETECT 2 // pin 2 for  sensor
#define ACTION 8 // pin 8 for action to do someting

void setup() {
  Serial.println("Robojax.com Laser Module Test");
  pinMode(DETECT, INPUT);//define detect input pin
  pinMode(ACTION, OUTPUT);//define ACTION output pin

  // Laser sensor code for Robojax.com


void loop() {
       // Sharp IR code for Robojax.com

  int detected = digitalRead(DETECT);// read Laser sensor
  if( detected == HIGH)
    digitalWrite(ACTION,HIGH);// set the buzzer ON

    digitalWrite(ACTION,LOW); // Set the buzzer OFF
    Serial.println("No laser");
       // Sharp IR code for Robojax.com