Arduino / ultra sonic sensor

I have not posted for a while good 2-3 years now as feel of ladder broke back,ribssss,concussion,blood clot spinal cord long time recovering but up and about now.Night mare few years

Trying to get back  robot building again,

having problems with Arduino Uno an my ultra sonic sensor HC-SRO4 

The program i used before does not seem to run them any more.

I have updated my libary with Newping...

real stupid question .. Can the Arduino or ultrasonic become faulty it left in box un used for a few years as before i broke my back they worked fine with the sketch below ?????????

when conected up to progrm before would give out distance reading very well.

 I am using windows 8 would this cause me problems?

i have tested the arduino uno i think !!!! to see if was reciving signal to each pin by connecting simple LED, to each pin in turn and getting it to flash which it done no problems( pins A0-A5 and 0-13)

sensors conected to arduino uno 

vcc - 5v

trigger - pin 8

echo - pin 7

gnd - ground

sorry if this is very basic  but having to start from scratch with what i know and remeber

cheers

 

#include <NewPing.h>

#define TRIGGER_PIN  8

#define ECHO_PIN     7

#define MAX_DISTANCE 200

NewPing DistanceSensor(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

void setup()

{

    Serial.begin(9600);

}

void loop()

{

    unsigned int cm = DistanceSensor.ping_cm();

    Serial.print("Distance: ");

    Serial.print(cm);

    Serial.println("cm");

    delay(1000);

}

You have my sympathy, mars
You have my sympathy, mars rover.

And I’m sorry, Max. I have a bunch of 10 year old srf-04s and srf-08s. I have t tested them yet, but I suppose I should do that before I need them. I can picture them going bad. :frowning:

I would try a simple "hello
I would try a simple “hello world” sketch. If that uploads and runs properly then the Arduino and uploading software are OK, even though they are running on Windows 8. :slight_smile:

As the otehrs already wrote,

As the otehrs already wrote, the hardware should not be broken but it’s possible. Some of the cheap Arduino’s does have (you guess) cheap components on-board. Cap’s just bleeding out, solder joints are bad, pins are corroded or other cheap stuff will just go to heaven.

Testing the Arduino with a simple serial output would help to rule out that the Arduino is broken. The sensor could be broken, so make sure that it’s wired properly and upload the NewPing example code to check the sensor reading. 

thanks all

 Thanks for all your help everone

I bought a new sonic sensor form local electronics shop, to test out on my arduino uno  

also deleted every thing of arduino off laptop an re einstalled it…  see if this helps too

ill get back let you know

thanks again for help