Wednesday, September 22, 2010

Day Five: Go Towards the Light

"Don't go towards the light!"
"I can't help it, its so beautiful, ahhhh." 

~A Bugs Life

So one of our signed challenges for today and the next class is to get our sciborg, referred to as John Silver, to find the light and approach it.  A simple seeming task at first.  If we just modify the line following to sense light instead....but it turns out to be a tad more complicated than that.

We want the light to be in the center, between the two sensors, which are on either side of our sciborg, almost like eyes.  The light sensors will really rarely want have the same reading, which would equate to the light being in the middle, so instead if the difference between the two sensors is a low number, then that will mean we can go straight.  But what happens if the light is between the sensors?

This is were we sorta' left off.  How to get the sciborg to reposition himself to get the light ahead of him.  After class, I had to do something else, so I practiced my oboe, but then came back to the problem and tried to put the solution of what I wanted in a paragraph.  Sensor one is the right 'eye' and sensor two is the left 'eye.'  What I came up with was If [S2-S1] < 200 go straight;  If [S2-S1] > 200 & S2 < S1 then it will go left; If [S2-S1] > 200 & S1 < S2 then go right.  If the sensors have a difference of more than 200 than the sensors are not equal enough to be going towards the light.  Then if this does happen and sensor one is getting a light reading lower than sensor two it is being pointed directly towards the light and so we need to correct the direction.  Vice versa for if sensor two is getting the more light. 





I'll try this next class and see if we can yet teach Johnny boy to find the light.  He hopefully won't have the same reaction as the moth when nearing the light.

Second Day--- Success. 

No comments:

Post a Comment