Hi, I'm using Arduino UNO and i've connected a HC-SR04 sensor but when i use the ultrasonic library it gives only 51cm when i run the code.
I want to get the cm and send it to Processing
My code is the next:
#include <Ultrasonic.h>
Ultrasonic ultrasonic(8,7); // (Trig PIN,Echo PIN)
void setup() {
Serial.begin(9600);
}
void loop()
{
Serial.print(ultrasonic.Ranging(CM)); // CM or INC
Serial.println(" cm" );
}
