Wednesday, December 4, 2013

Coding

After a long time struggling with GitHub and the alien terminology (forking, committing, bashing, etc.) that goes with it, I finally found out how to put my code on there. First to tackle was the problem of implementing the LED lights to blink without using a 2 second delay that would disrupt all other functionality. My code focused on using iterations of the loop function as a counter that would go up to two seconds and, upon reaching that count, execute the light turning on/off. This is seen here:


The issue with this was that you needed to know just how long it takes for a loop function to execute – I estimated on the low side and figured I could raise the counter limit until it equated to 2 seconds. Bobby figured out a way that would both avoid multiple tests as well as the loops:


I also worked on coding the servo motor and ac motor so that their movements would respond to a potentiometer. This was a test that prepare us for integrating the motors with the iPhone interface – since the adjustment of the potentiometer is similar to that of the app. Each is shown below:


Bobby then put the blinking light code together with the servo code so it was all in one. All that would be needed now is to add the motor in this:


Finally Bobby introduced a unique idea to use the light sensor for the LED in place of the potentiometer – that way, the screen would adjust itself according to the amount of light around it:



With this code we still have the trouble of connecting it to the iPhone app, however. More work will need to be done before any of this can be tested and debugged, but so far it looks good.


- Mike

-       

No comments:

Post a Comment