Skip to content

Arduino library for interfacing with GP2Y0A41SK0F IR sensor.

Notifications You must be signed in to change notification settings

legonko/Sharp-GP2Y0A41SK0F-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IR-Sensor Library

This repository contains an Arduino library for interfacing with the GP2Y0A41SK0F IR distance sensor. The library provides easy-to-use methods for reading distance values and checking if a specified threshold is exceeded.

Installation

git clone https://github.com/yourusername/IRSensor.git

Usage

Include the IR-Sensor library in your sketch and create IRSensor objects for each sensor you are using (e.g. see emergencuStop.ino).

Library Reference

Construcor

IRSensor(int pin, int safeDist)

  • pin: The analog pin to which the sensor is connected.
  • safeDist: The distance threshold for the sensor.

Methods

  • void begin(): Initializes the sensor.
  • int getDistance(): Returns the distance measured by the sensor.
  • bool isBelowSafeDist(): Returns true if the measured distance is below safe distance.
  • int getSafeDist(): Returns the safe distance value.
  • void setSafeDist(int newSafeDist): Sets a new safe distance value.
  • int getPin(): Returns the analog pin number the sensor is connected to.

About

Arduino library for interfacing with GP2Y0A41SK0F IR sensor.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages