Thursday, September 11, 2008

Fixing Physical Computing Homework

Thanks Kevin it seems to work :)

My brother Kevin, who lives in Florida and works as a Flash developer, had an idea about how to fix my code. He sent me a snippet of the void loop() section and I swapped it in and then rearranged the variables.

His idea was to check the switchState on every iteration of the for loop. Since switchState would only return 0 or 1(no or yes), he added the value of switchState to the lower of the two LED pins(pin 3) which were in pins 3 and 4.

Code snippet:
void loop() {
for (int i=10; i >= 1; i--){
// read the switch input at the beginning of
// each loop iteration
switchState = digitalRead(switchPin);
digitalWrite((ledPin + switchState), HIGH);
digitalWrite((ledPin + switchState), LOW);

Here is a video:

Physical Computing Week 1 Homework FIXED from Matt Richard on Vimeo.


  1. Cool! Glad it worked! By the way, the site is about three years old... The site that I am concentrating on is or you can check out some of the launchpages:,, or to name a few).

  2. I have been a herpes carrier for 2 years and I tried every possible means of curing but all of no useful until I saw a health promotion on a herbalist from West Africa who prepares herbal medicines to cure all sorts of diseases including #HSV and many others sickness but look at me today am very much happy and healthy, I'm telling you today don't lose hope keep trying God is with you, If you needs Dr.Chala help contact him on his email or you can visit his website on or