The first day back from winter break turned out to be a snowday for many of our sending schools. For those few souls in PreTech that made it to school that day, we had a fun day planned with robots and programming. Many robots were in play that day, we had the Ozobot, an Sphero, the Finch as well as my robot - the Wink.
After a troubling installation of the software and nearly having my paired student lose interest, I finally got the Arduino software mapped to the correct directories. Teaching myself has mostly been a trial of mistakes and practice, and I knew that working with this student was not going to be so easy, as I had to explain what Void Setup, Void Loop and other programming features of working with the Arduino based platform. We decided to run a program on the WINK just to manage the eyes. Our code looked like this:
void loop(){
leftCyan(100); //make left eye cyan color
delay(20); //stay on for a short time
eyesOff(); //turn eyes off
delay(100); //delay between blinks
leftCyan(100); //begin second blink
delay(20); //stay on for a short time
eyesOff(); //turn eyes off again
delay(2000); //time before 2nd eye blinks
rightCyan(100); //make right eye cyan color
delay(20); //stay on for a short time
eyesOff(); //turn eyes off
delay(100); //delay between blinks
rightCyan(100); //begin second blink
delay(20); //stay on for a short time
eyesOff(); //turn eyes off again
delay(2000); //time before repeating
}
Once the student learned what the delays were and what colors he could call out, he started to change the code, copy the code and add to the code to run the WINK through a series of color changes and brightness stages. Adding brightness, the code looked like this:
void loop(){
eyesBlue(25); //set both eyes to blue, at brightness 20
delay(200); //wait a short time
eyesBlue(75); //set both eyes to blue, at brightness 75
delay(200); //wait a short time
eyesBlue(125); //set both eyes to blue, at brightness 125
delay(200); //wait a short time
eyesBlue(175); //set both eyes to blue, at brightness 175
delay(200); //wait a short time
eyesBlue(225); //set both eyes to blue, at brightness 225
delay(200); //wait a short time
eyesOff(); //turn eyes off
delay(1000); //wait 1 second then repeat
}
Again, he repeated the code, changed the colors, brightness levels and so on. Eventually we called out RGB color by using his favorite colors from Color Scheme Designer. While just remixing, the student who was initially not too excited, responded and said "Cool". Which I'll confirm as a small success.
No comments:
Post a Comment