Good morning! I've completed the following steps to the $50 robot:
1.) Assembled structure
2.) Completed circuit board
3.) Uploaded Program to AT Mega 8
4.) Calibrated Servo's
5.) Connected Servo's to circuit and attached to robot structure.
6.) Attached both photocells to robot structure and PINS PC4 and PC5
As you can see, I'm basically done... But what seems strange is that it doesn't seem like the sensors are making any type of affect on the robot... If I cover the photocells with my hands the voltage on the wire going to PC4 will drop considerably and if I put a light on the photocell the voltage will increase to around 4 something volts. I'm pretty certain that this is the expected behavior... Sometimes when I'm playing around with it one of the wheels will start to jiggle a little. So right now I'm playing with the code and changing some of the values going to the servos.
I tried setting both servos to 0 and what I got was that one wheel rotated one way while the other rotated a different way. I'm pretty sure this is correct behavior because the servo's are opposite of each other so I'm telling both to go backwards. I'm trying to do some debugging because I want to see when it catches the two if statements where the light is greater on one side than on the other. I guess I figured this out when I was out tinkering in my garage at 12:00 AM and I let it run out of the garage into the dark and it kept going straight until it ran into a plant. I guess it has a mind of its own
Anyhow, I was wondering if anyone else has had a similar problem? I just want to make sure that the sensors are being read correctly. Maybe I need to play with the threshold a little. I guess every case is different and will need to play with the values. I had another quick question about the LED on the board. I noticed the code says: LED_off();//turn LED on; Is that correct? I thought maybe it was put that way because the port PD4 is active low maybe? I wasn't sure. The reason i'm asking is because my LED is not coming on. I've tried setting LED_on(); but it doesn't seem to work either. I have a feeling my LED might have been burned out from to much voltage when I was putting the circuit board together so I can put another one in there, but I wanted to know which function to use to turn it on and then to turn it off. I'm going to use the LED to debug when I hit one of the if statements. Thank you for your help in advance!