Society of Robots - Robot Forum
Software => Software => Topic started by: jessman275 on February 02, 2010, 12:08:46 PM
-
Hey Guys and Gals,
For some reason i keep getting this error.
control.c:7: error: 'value' undeclared (first use in this function)
( Each undeclared identifier is reported only once.
for each funtion it appears in.)
then ill get
error: `PORTE` undeclared ( first use in this funtion )
my code is.
int control(void)
{
while(1)
{
value=a2dConvert8bit(0);
if(value > 128)//depends on values you expect
PORT_ON(PORTE,6);
else
PORT_OFF(PORTE,6);
delay_ms(10);//prevent crazy fast oscillation
}
}
.........................
this code is in my control
-
You have to declare "value" before you use it, put "int value = 0;" somewhere before you use it. The other errors and warnings are probably because you do not have SoR_Utils.h included in your code. Try puting "#include <SoR_Utils.h>" at the top of your code.
-
So i keep getting a error that is puzzling me. Its "control.c:16: warning: implicit declaration of function 'a2dConvert8bit' " the code is
#define PORT_ON( port_letter, number )
#define PORT_OFF( port_letter, number )
#define PORT_ON( port_letter, number ) port_letter |= (1<<number)
#define PORT_OFF( port_letter, number ) port_letter &= ~(1<<number)
int control(void)
{
while(1)
{
int se5=0;
se5=a2dConvert8bit(0);
if(se5>100)//depends on values you expect
PORT_ON(PORTE,7);
else
PORT_OFF(PORTE,7);
}
}
I have a2d.c and a2d.h added to the source and header files. I have been debugging and cant figure this out. I am trying to take a input from a IR sensor ( on F 5 ) and every time it pulses it will send signal to port E 7 to switch a mosfet. Am i on the right track besides the error that im getting?
Thanks
Jesse