Having trouble with programing
Up to Development Discussion
I'm trying to learn to program the make controller, but I can't seem to get eclipse to allow me to write anycode for it. I followed the how to on programing the controller with eclipse, but it still won't work. I can't modify the heavy firmware. Can some one help? Thanks,
Brian
Ok, I've got every thing working, I've started with a little program that doesn't seem to be working. I'm trying to get the make controller to read values from the analog input 1 and then move a server to a set position.
#include "config.h"
#include "servo.h"
void AinServoTask( void* p );
void Run( ) // this gets called as soon as we boot up.
{
TaskCreate( AinServoTask, "AinServo", 1000, 0, 3 );
}
void AinServoTask( void* p )
{
(void)p; // unused variable
int i;
int ain;
while( true )
{
AnalogInput_GetValue(1);
if (1>1);
{
Servo_SetPosition (1, 800)
}
else
{
Servo_SetPosition (1, 250);
}
Sleep(1);
}
}
I've built it and up loaded it to the controller, but the servo just spins one way and doesn't do anything when I hit the switch hooked up to analog input 1. Either I'm messing up in the programming or the hardware, I have the switch so it will ground the input. Can some one help me out?
oh ok, sry i didn't know that would happen, I'll do that next time. I tried that but it's still not working, now the servo won't move at all. http://pastie.org/250733 <-- code with the ain = AnalogIn_GetValue(1); in it. But it's complaining about ain. It's saying "ain undeclared (first use in this function) (Each undeclared identifier is reported only once for each function it appears in.) I can't figure out what to fix on it, should I put int before, so it's like
int ain = AnalogIn_GetValue(1);
or is there something else I'm missing
thanks
In your previous example, you had declared "int ain;" - not sure why you removed that, but you need it back. Or declaring it as you specified above as "int ain = AnalogIn_GetValue(1);" would be fine.I put int ain = AnalogIn_GetValue(1) and I'm getting a new message that on line 13 it's expecting an identifier or( before token {, yet there is an identifier there to my knowledge.

