I wanted to be able to read the distance captured from the ultrasonic range finder device on a microcontroller, to know how to implement this device in a possibly bigger and more complex circuit later on. Starting simple, this code prints out a pattern relative to the distance output of the DYP-ME007. I am using my Atmel STK500 for both programming and operation of the AtMega8, and the pattern will be displayed on the STK500 leds. The comments in the C code will describe what is being done and why. Since C code specific syntax highlighting is not one of blogspots features, I will add a clean syntax highlighted image, and you can always download the code here.
The video quality is no good, but it’s easy to see what is going on. Notice the waveform on the scope in the background.