Wednesday, January 26, 2011

Day 7: Working on Hacking a Toy

Well, today was tiresome. I was having difficulty understanding how to properly control the remote to my toy robot. Irritating situations kept arising, such as: the circuitry not being set up right, the remote not responding as it should, and bad programming on my part. I added a few wires which were linked to the individual controls: forwards, backwards, left, and right.

Unfortunately, one of the "situations that came about was that the remote would signal constantly if more than one control was hooked up to the microcontroller.

Eventually, it was decided that I should have just one input hooked to the microcontroller, and that it would be activated with a LDR (Light Dependent Resistor). It was supposed to work like this; when the LDR detected a decreased level of light, the microcontroller would switch to a simple command to drop the voltage in the controller which would activate it and make it send the code that would tell the robot to go forwards.

Eventually it actually worked, but my camera was dead so I couldn't record it. Adding more stress to the fun, I haven't been able to recreate it at home now that I have a working camera again. My first suspicion is that the batteries in the remote might be drained now, and I honestly don't have any spare button cell batteries laying around the house.

After awhile, I managed to recreate it and got it recorded this time.


I used this code:
main:
 readadc 4,b0
debug
if b0>190 then top
if b0<170 then bot
goto main
top:
 high 1
goto main
bot:
 low 1
goto main

I realize that some of the code is unnecessary, but I'm not knowledgable enough yet to perfect it.

No comments:

Post a Comment