qub1750ul / Arduino_SharpIR

Arduino library that allows to acquire distance data from Sharp IR sensors
Creative Commons Attribution Share Alike 4.0 International
21 stars 11 forks source link

Please help I'm having errors using this library #1

Closed michaelyasay closed 8 years ago

qub1750ul commented 8 years ago

@michaelyasay Please explain the problem / post compilation errors

michaelyasay commented 8 years ago

Bellow are the errors got when i compile,

Arduino: 1.6.11 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/michaelyasay/Documents/Home_Automation/Arduino/Projects/libraries/SharpIR_41/src/SharpIR.cpp:3:1: error: prototype for 'SharpIR::SharpIR(String, int)' does not match any in class 'SharpIR' SharpIR::SharpIR(String _sensorType, int _sensorPin) ^ In file included from /Users/michaelyasay/Documents/Home_Automation/Arduino/Projects/libraries/SharpIR_41/src/SharpIR.cpp:1:0: /Users/michaelyasay/Documents/Home_Automation/Arduino/Projects/libraries/SharpIR_41/src/SharpIR.h:24:7: error: candidates are: constexpr SharpIR::SharpIR(SharpIR&&) class SharpIR ^ /Users/michaelyasay/Documents/Home_Automation/Arduino/Projects/libraries/SharpIR_41/src/SharpIR.h:24:7: error: constexpr SharpIR::SharpIR(const SharpIR&) /Users/michaelyasay/Documents/Home_Automation/Arduino/Projects/libraries/SharpIR_41/src/SharpIR.h:28:5: error: SharpIR::SharpIR(String, uint8_t) SharpIR(String _sensorType, uint8_t _sensorPin); ^ exit status 1 Error compiling for board Arduino/Genuino Uno.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

qub1750ul commented 8 years ago

@michaelyasay I've just published a new release of the library that fixes your problem. The new version will be available on the arduino library manager in about an hour. If you don't want to wait you can download it from github and replace you current version with the new version.

michaelyasay commented 8 years ago

Hi, I just tried the updated library with "GP2YA41SK0F" sensor, and the values does not change on the serial monitor, it is always "52". I was to make the "GP2YA21SK0F" sensor on same board but different library. I this there still bug on it. I try to do simple analog read as well to the '"GP2YA41SK0F" and also changes it values as obstruction is infront of the sensor.

qub1750ul commented 8 years ago

@michaelyasay I've tried the library now with my own GP2YA41SK0F and it function correctly. Are you sure that there aren't mistakes in your code? Note that the library code for GP2YA41SK0F can only return values beetween 3 and 31.

michaelyasay commented 8 years ago

Works now, I have used same board these morning and couldn't get to work and now working perfect. Thanks again for your help.

By the way any plans in adding the "GP2Y0A710K0F" model?

qub1750ul commented 8 years ago

@michaelyasay If i get one, or someone elaborate and test the mathematical formula needed for the calculation from the datasheet, i surely add it