Chapter 3 Assessment: Projects

March 5, 2011 at 9:16 am (Uncategorized)

The answers for the Questions and Exercises are in the blog post “Day 10”, because I finished it last class and I was able to finish the projects during this class.

1) Modify RightServoTest.bs2 so that it makes a tone signifying the test is complete.

To modify the RightServoTest.bs2 so that it makes a tone to signify that the test is complete, I have to use the FREQOUT command. The FREQOUT command is used to control the frequency and duration of the piezospeaker and the piezospeaker produces the tone. First, I had to put the pin number of the piezospeaker as the first value of the command. Then, I had to type in the duration or how long the tone will last. Last, I have to type in the frequency or how high or low the ending tone of the program will be.

I didn’t have any challenges with this project, because I remembered that the FREQOUT command was used to control the piezospeaker and the piezospeaker is in charge of making the tone, so it was easy for me to modify the program. However, I needed to review myself a bit on how to write the FREQOUT command values in the right order because I mixed up the duration and the frequency values when I first typed it into the program. Instead of typing “FREQOUT 4, 500, 3000”, I wrote “FREQOUT 4, 3000. 500”. I was able to figure out that I messed up when I reread the section in Chapter 3 about the FREQOUT command.   

2) Modify TestServoSpeed.bs2 so that you can use DEBUGIN to enter the pulse width for the left and right servo as well as the number of pulses to deliver in the FOR…NEXT loop. Use this program to control your Boe-Bot’s motion via the Debug Terminal’s Transmit Windowpane.  

For this project, I had to modify the TestServoSpeed.bs2 so that I can use the DEBUGIN command to control the left and right servo and the number of pulses. I figured out that I had to put multiple variables in the program because I needed to put variables for the pulse width, the left servo, the right servo, and the counter for the FOR counter command. I found it challenging to figure out how to put the variables in the program. I looked at the solution for Project 2 and I found out that I had to write a DEBUGIN command for every variable except for the counter variable. After I wrote the DEBUGIN commands for the three variables, I had to modify the FOR counter command to 1 to NumberofPulses. Last of all, I had to modify the PULSOUT commands by putting in the variables after the pin number because I’m controlling the pulse width for the servos, instead of having a fixed pulse width.

Leave a comment