Hello, Mr. Idris, First thing first, thank you for willing to reply my request. Okay, here the picture i attached together. And the coding is provided as follow :
- CODE: SELECT_ALL_CODE
/*=========================================================
Infra-Red distance measures: Send distance value in centimeters to serial
Connection the sensor to the Arduino:
sensor - arduino
VCC - 5V
Gnd - GND
OUT - A0
Briefing:
This program has the sole purpose of measuring distances with the Infra-Red sensor.
It uses a previous calculated regression to convert analogRead values into distance values.
*/
const int irsensorpin = A0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop(){
// Reads the InfraRed sensor analog values and convert into distance.
int sensorValue = analogRead(irsensorpin);
double IRdistance = 187754 * pow(sensorValue, -1.51);
Serial.println(IRdistance);
// A delay is added for a stable and precise input
delay(100);
}
I connect the sensor to arduino by
OUT to A0, 5V to 5V, 3.3V to 3.3V, GND to GND,I tried with this coding the serial monitor does not give any number. Looking forward for the reply. Thank Sir
Sorry for the messy table in the picture.