Problem with arduino uno + PS2 shield

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

Problem with arduino uno + PS2 shield

Postby proton_gt » Fri Oct 03, 2014 4:02 pm

hi all.
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??
proton_gt
Fledgling
 
Posts: 1
Joined: Fri Oct 03, 2014 3:14 pm

Re: Problem with arduino uno + PS2 shield

Postby yonghui » Tue Oct 07, 2014 10:55 am

hi,
can you try to troubleshoot the condition?
try to light on LED of arduino UNO when the triangle, circle or square is pressed. if the LED can light on without any problem, then the problem comes from the remaining code. I cant understand what is the running program problem meant by you. mayb you will need explain more.
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm


Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 20 guests

cron