Giter Site home page Giter Site logo

arduino-gp2y0a21yk-library's Introduction

Arduino-GP2Y0A21YK-library

Library for the Sharp GP2Y0A41SK IR Distance sensor.

This library uses a lookup table in program memory to convert the ADC values to distance values. This library was a test to evaluate code size and processing time.

An alternative library, where the board does the actual calculation on the CPU can be found here

arduino-gp2y0a21yk-library's People

Contributors

jeroendoggen avatar thomasaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

arduino-gp2y0a21yk-library's Issues

Can't get any results

I can't seem to get this thing to work, at all.

What Happens: Serial monitor reports any input as minimum input (255 raw, 10cm with Centimeters, 1246 mV). In my glances through your source, these are the "Defaults" if it doesn't find actual information.

What I've tested:
I used this site: http://bildr.org/2011/03/various-proximity-sensors-arduino/
Wired it up as stated, which is the same wiring this needs. Go to serial monitor, and the values change as I move things in front of the table.

My first thought is that I was wiring it wrong, but even after trying every single other pin (Both analog and digital, for good measure) on my Arduino Uno (R3), I had no changes from this code.

My second thought was that the pin was listed wrong in this code (As the example uses pin "A0" and the link above uses the pin "0") so I changed that to "0" and still have had no change.

If I look at the LED in just the right angle, I can see the faint red from it, so the sensor is working. There's just something wrong somewhere else. Any help would be greatly appreciated.

Wrong distance values

I used this Library with an GP2Y0A21YK Sensor and run the Example code for reading Centimeter on an Arduino Nano und am receiving incorrect values.
I meassured the distance with a tape meter and at 15cm I get the Serial reading "8", at 20cm I get "11", at 25cm I get "13", at 30cm I get "15".
What could cause those misreadings?

Verify fails with Error compiling

From [email protected] on May 21, 2013 08:07:56

What steps will reproduce the problem? 1. Load any of the examples into the Arduino IDE
2. Verify
3. Verify fails with Error compiling What is the expected output? What do you see instead? In file included from /usr/share/arduino/libraries/DistanceGP2Y0A21YK/DistanceGP2Y0A21YK.cpp:28:0:
/usr/share/arduino/libraries/DistanceGP2Y0A21YK/DistanceGP2Y0A21YK_LUTs.h:1:1: error: ‘prog_uchar’ does not name a type
/usr/share/arduino/libraries/DistanceGP2Y0A21YK/DistanceGP2Y0A21YK_LUTs.h:21:1: error: ‘prog_uchar’ does not name a type
/usr/share/arduino/libraries/DistanceGP2Y0A21YK/DistanceGP2Y0A21YK.cpp: In member function ‘int DistanceGP2Y0A21YK::_mapGP2Y0A21YK_CM(int)’:
/usr/share/arduino/libraries/DistanceGP2Y0A21YK/DistanceGP2Y0A21YK.cpp:122:14: error: ‘transferFunctionLUT3V’ was not declared in this scope
/usr/share/arduino/libraries/DistanceGP2Y0A21YK/DistanceGP2Y0A21YK.cpp:131:14: error: ‘transferFunctionLUT5V’ was not declared in this scope What version of the product are you using? On what operating system? library v0.3 on Arduino IDE v1.0.1 on Linux Mint 14 64-bit. Please provide any additional information below. I can run other arduino libraries on the same setup.

Thanks- this will be really useful if I can get it going!

Original issue: http://code.google.com/p/gp2y0a21yk-library/issues/detail?id=1

Add readme.md

Based on text that used to be on the google code page. (use internet archive?)

Sporadic Readings

Hi there, I hooked up my GP2Y0A21YK sharp IR sensor tomy arduino UNO and downloaded your latest library.I had some sporadic readings, which were far from the unexpected. I wish you could be of help. I checked out the voltage values and compared it with that on the datasheet and I realized that they were different from the centimeter readings I was getting from your library. Below are a sample of the centimeter readings and the voltage readings.

Also I would like to know if there are any best practices in using this sensor for measuring accurate distances. Thanks

Distance in centimers: 34
Distance in centimers: 30
Distance in centimers: 30
Distance in centimers: 34
Distance in centimers: 38
Distance in centimers: 31
Distance in centimers: 35
Distance in centimers: 32
Distance in centimers: 34
Distance in centimers: 35
Distance in centimers: 34
Distance in centimers: 35

ADC input mV: 347
ADC input mV: 244
ADC input mV: 542
ADC input mV: 386
ADC input mV: 391
ADC input mV: 386
ADC input mV: 366
ADC input mV: 327
ADC input mV: 342
ADC input mV: 371
ADC input mV: 420
ADC input mV: 532
ADC input mV: 366
ADC input mV: 400
ADC input mV: 366
ADC input mV: 347
ADC input mV: 347
ADC input mV: 347

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.