SJN-SR04T errors only showing minimum distance

I have been trying to set up the SJN-SR04T with the Arduino Mega that is attached to a raspberry pi model 3. I have the sensor attached to the 12 and 11 port for the trig and echo wires respectively. I can’t figure out why when I run my code the only thing that shows up in 20cm repeating regardless of where I point it. can anyone shed some light on the problem it would be greatly appreciated! Thanks. please see my code below

// ---------------------------------------------------------------------------
// Example NewPing library sketch that does a ping about 20 times per second.
// ---------------------------------------------------------------------------

#include <NewPing.h>

#define TRIGGER_PIN  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

void setup() {
  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.

void loop() {
  delay(50);                      // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  unsigned int uS =; // Send ping, get ping time in microseconds (uS).
  Serial.print("Ping: ");
  Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)

try "unsigned long". There are lots of microseconds in there...

Yes, unsigned int uS =; // Send ping, get ping time in microseconds (uS).

unsigned int will only give 0 to 65535 microseconds, which is only 65.5 milliseconds, not very long.

An unsigned int should be able to hold enough us for a sensor that's getting a reading within its limit of 3 meters (that's about 20 ms, 20000 µs, so even a regular int works for that). I normally read this sensor using the pulseIn with a 33000 µs timeout - that's for a distance of about 5 meters (round trip 10 meters - at 300 m/s that takes about 33 ms), which is out of it's specified range already.