Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Slothery on August 04, 2010, 10:24:41 AM

Title: More $50 Robot LED Troubles
Post by: Slothery on August 04, 2010, 10:24:41 AM
Upon installing my LED correctly (the poles were connected backwards) I have found that it still does not shine for my photovore code. However, the LED is constantly shining when I upload the .hex file used to center servos (the program provided by the website). I was wondering if someone could help me get my LED to shine for the photovore code.
Title: Re: More $50 Robot LED Troubles
Post by: Razor Concepts on August 04, 2010, 11:00:34 AM
There should be some LED_ON() and LED_OFF() commands somewhere, dig around through the Sor_utils file and it should be there
Title: Re: More $50 Robot LED Troubles
Post by: Slothery on August 04, 2010, 11:54:27 AM
I have found the LED_ON() and LED_OFF() in the Sor_utils file now what am I to do to make my LED turn on when I power the board?
Title: Re: More $50 Robot LED Troubles
Post by: Razor Concepts on August 04, 2010, 12:20:15 PM
At the beginning of the code place "LED_ON();"
Title: Re: More $50 Robot LED Troubles
Post by: Slothery on August 05, 2010, 08:59:31 AM
Ok so my program now looks like this:

Quote
LED_ON;
#include <avr/io.h>          // include I/O definitions (port names, pin names, etc)
#include <avr/interrupt.h>   // include interrupt support

//AVRlib includes
#include "global.h"      // include global settings
//#include "buffer.h"      // include buffer function library
//#include "uart.h"      // include uart function library
//#include "rprintf.h"   // include printf function library
//#include "timer.h"      // include timer function library (timing,

After inserting "LED_ON;" right at the beginning of the code I hit (CTRL+S) to save it and then found my photovore .hex and uploaded that code to my board via my AVRISP MKII. However my LED still doesn't shine. Did I mention that the LED shines when the centering program provided by the website is on the board? Could you not find out what the centering program does that the photovore program lacks?
Title: Re: More $50 Robot LED Troubles
Post by: amando96 on August 05, 2010, 09:28:13 AM
LED_ON; ≠ LED_ON();

I'm pretty sure there is a difference, I may be wrong, haven't touched this in a while.
Title: Re: More $50 Robot LED Troubles
Post by: Razor Concepts on August 05, 2010, 09:53:29 AM
Saving it won't update the hex file. You must rebuild the program (I believe there is a button called "build all" or something like that). After doing a successful build, then the hex would update.
Title: Re: More $50 Robot LED Troubles
Post by: Slothery on August 05, 2010, 11:25:55 AM
Alright guys I got the LED to light up! Here's how I did it. I opened the photovore source code file and changed
Quote
LED_off();
to
Quote
LED_on();
Then I hit F7 to build the program and voila! the LED glows.