On week 11 I made a board that measures distance.

This code operates the ultrasonic sensor.

digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(5); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); cm=duration/29/2;

The way the code works is by sending a pulse with the trigger pin, waiting for the pulse to come back, measuring the time it took, and calculating the distance with a simple math.

I wanted to experience working with python. I started by milling and soldering a step response sensor.You can download the milling files by clicking the two left pictures.

4

4

I had a problem with my FabISP so I used the AVR ISP to program the sensor. I downloaded the Make, C and Python files and used Ohad's Mac to program it.

I opened the terminal and changed the directory to where I saved my files. First command is: sudo make -f hello.load.45.make program-avrisp2. After writing it you should get this message.

4

The second command is: avrdude -p t45 -c avrisp2 -U flash:w:hello.load.45.c.hex. After writing it you should get this message.

4

To find my serial port of the board attached in terminal I wrote ls /dev/tty.usb*, I copied the USB port to a new line: python hello.txrx.45.py /dev/tty.usbserial-FTF53NJC

4