5. Finishing the robot

We connected the heart to a PWM-port, so that we could control the brightness of the LED-light. We wrote following piece of code which enabled us to let the heart beat:




































We change the brightness of the LED, between a value of 0 (OFF) and 255 (ON). First we fade from 0 to 255 - we increment with 10 (fadeAmount) every 10 ms. Then we fade it back, but not to 0, but to 50 - we decrease every 5 ms (so it goes faster). Right after that, we increment it back to 255 (the second pulse). Lastly, we slowly fade back to 0, decreasing it with 10 every 40ms.

Because we couldn't multithread with our arduino, enabling to set the function of the heartbeat, and the walking loop at the same time, we decided, to add another arduino (we used an UNO).

Since we didn't had a lot of time left, we taped our UNO at the back of the robot.



.

We placed the heart at te left-front of the robot, using double sided tape.





















We tweeked the infrared sensor, by placing it in a light angle, so he would see lower placed obstacles.









No comments:

Post a Comment