Author Topic: Axon button help  (Read 2189 times)

0 Members and 1 Guest are viewing this topic.

Offline JdogTopic starter

  • Robot Overlord
  • ****
  • Posts: 259
  • Helpful? 3
Axon button help
« on: January 28, 2009, 11:20:30 AM »
I'm trying to make the axon run the program without having to press the button first. I looked at the axon source code page and under the button part it only says how to make code pause until you press the button. So I figured if you remov that piece of code, it would just run when you turn it on. So I tried // before the code like this:
Code: [Select]
/*********ADD YOUR CODE BELOW THIS LINE **********/

rprintf("Initialization Complete \r\n");

//wait until user pushes button
//while(!button_pressed());

reset_timer_0();
reset_timer_2();

while(1)
{
control();//use this for your code

delay_cycles(100);//an optional small delay to prevent crazy oscillations
}
/*********ADD YOUR CODE ABOVE THIS LINE **********/
When I uploaded it to the axon nothing different happened. It acted as if I didn't change anything. Anybody know if I'm doing something wrong?

Offline mbateman

  • Full Member
  • ***
  • Posts: 82
  • Helpful? 0
    • Robotics 4 Fun
Re: Axon button help
« Reply #1 on: January 28, 2009, 11:49:39 AM »
That should do it. I have had times that the AVR Studio did not build correctly or recognize that a file was changed. You might try "Rebuild All" and then scroll back up through the output to make sure there were no warnings or errors before loading the program to the Axon. Also, if that does not do it, try putting in some debugging output so you can see if it gets to the next part of your code.

Offline JdogTopic starter

  • Robot Overlord
  • ****
  • Posts: 259
  • Helpful? 3
Re: Axon button help
« Reply #2 on: January 28, 2009, 05:59:28 PM »
I rebuilt it and uploaded it 3 more times and still nothing. Everything works fine, just when I turn it on I still have to press the button before control starts.

Offline JdogTopic starter

  • Robot Overlord
  • ****
  • Posts: 259
  • Helpful? 3
Re: Axon button help
« Reply #3 on: January 28, 2009, 07:31:17 PM »
I figured it out, it turns out the first thing I tried to do was right, but I was doing it in the wrong file.

 


Get Your Ad Here

data_list