Back to Parent

Process and Result

We primarily dealt with setting up the servo motor for movement and getting it working. The code of the servo motor was problematic. The first time we flashed the code, the servo motor turned 60 degrees and stopped. Then we changed the delay durations couple of times, increasing and decreasing, thinking that the delay might have been too short and the movement too fast to prevent the motor from turning 180 degrees probably. However, even with the same delays, the motor would sometimes work and sometimes would not. The movements were erratic and random. Finally, we realized that because there was no delay between the for loops, the motor couldn't find the moment to react to the code and do the second forloop to move backwards. After setting delays at the end of for loops and changed the delay durations for longer, our servo motor started moving back and forth with complete 180 degrees and normal pace. 

Then we also modified the SkillsDev code of piezo to respond to its own pushbutton with the melody that would also trigger the movement of the servomotor in the interaction. For this reason, we connected the objects (servo motor and piezo) through shared event code under GRP5_SZL by defining two new events (see below codes). As a result, when we push the button on piezo's circuit, the piezo plays the melody and the servo motor on the other circuit board moves (dances!) with the melody. 


Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0