Alright, I'm programming a PIC18F4550 Microcontroller to control a little robot. We were just given ultrasonic sensors to add to our robots but I'm not really sure on how i can right a program to use it. All i need it to do it sense a wall in front and turn the robot around and go back the other way.
The sensor uses a pinging system where it will hit the wall and then send a 1 to the microcontroller once it returns to the sensor, or so i think.
Al ink to the sensors page:
http://www.parallax.com/tabid/768/Produ … fault.aspx
I was thinking of just righting a delay so that it would ping a few times and then turn around, but i think this sensor can detect past 10 feet so this idea may not work.
Then I though, well if its sending a 1 for each ping then i should just have it count up to a certain value and that certain value can represent a distance away.
How should i go around implementing this sensor?
All programing is done in embedded C
The sensor uses a pinging system where it will hit the wall and then send a 1 to the microcontroller once it returns to the sensor, or so i think.
Al ink to the sensors page:
http://www.parallax.com/tabid/768/Produ … fault.aspx
I was thinking of just righting a delay so that it would ping a few times and then turn around, but i think this sensor can detect past 10 feet so this idea may not work.
Then I though, well if its sending a 1 for each ping then i should just have it count up to a certain value and that certain value can represent a distance away.
How should i go around implementing this sensor?
All programing is done in embedded C