i have problem with my source code.
- CODE: SELECT_ALL_CODE
//Panning control
int panchange = 2;
if( ps2.getval(p_triangle)==0) //Triangle button is pressed
{
panpos = panpos + panchange;
}
if( ps2.getval(p_cross)==0) //Cross button is pressed
{
panpos = panpos - panchange;
}
panpos = constrain (panpos, 0, 180); //limit of value tilt position
panservo.write(panpos);
delay(500);
//Tilting control
int tiltchange = 2;
if( ps2.getval(p_circle)==0) //Circle button is pressed
{
tiltpos = tiltpos + tiltchange;
}
if( ps2.getval(p_square)==0) //Square button is pressed
{
tiltpos = tiltpos - tiltchange;
}
tiltpos = constrain (tiltpos, 0, 180); //limit of value tilt position
tiltservo.write(tiltpos);
delay(200);
if( ps2.getval(p_r1)==0) //R1 button is pressed
{
tiltservo.write(90); //tilting home positioning
panservo.write(90); //panning home positioning
delay(200);
}
some the code for getval(p_xxx) will change into blue font in IDE, but some code will stay black font.
the problem is when I upload the program, the button that change into blue font will problem when program running but the button that stay in black font ok.
in this sketch, triangle, circle and square will change into blue font but others stay in black font. is that will effect the program?? what is the mistake with my program??