2850Views3Replies

Author Options:

When using a sharp ir distance sensor (analog), with arduino, can I use the same code as if I was using a potentiometer? Answered

With Arduino, can I use the sharp ir sensor (analog) with the same code as a potentiometer? If not could somebody give me a code example?

3 Replies

user
steveastroukBest Answer (author)2009-08-11

ASSUMING the output voltage of the Sharp is scaled exactly the same as the "potentiometer", yes, probably. Steve

Select as Best AnswerUndo Best Answer

user
MatanSilver (author)2010-04-26

It depends on if the output of the sensor is resistive or digital.

Select as Best AnswerUndo Best Answer

user
rickharris (author)2009-08-10

Generally yes - The sharp sensor will return a number between 0 and 255 which is proportional to distance. if you want to knw real distances you will have to scale the figures in software.

Select as Best AnswerUndo Best Answer