Shop Learn
SimpleIDE error issue? — Parallax Forums

SimpleIDE error issue?

I have been trying to learn c and modifying the examples.
I get this error and I have been trying to solve this for hours.
I need some help.

Thank you
siri

ps- attached are the compilation error and zip file.

Comments

  • A couple of items here.

    First you don't need to copy all the libraries into this folder to use them unless they are some special libraries.
    SimpleIDE can reference them from the learn folder if need be.

    Attached is and update to your project that has the library referenced correctly. The library folder can be deleted in your project then.

    Also the error is because of the missing item on the while clause.

    /*
      Follow with Me withPing.c
    
      ## NOT COMPILNG _ ERROR ##
    
      https://learn.parallax.com/ab360
    */
    #include "servo360.h"
    
    #include "simpletools.h"                      // Include simpletools header
    #include "abdrive360.h"                       // Include abdrive360 header
    #include "ping.h"                             // Include ping header 
    #include "sirc.h"
    #include "wavplayer.h" 
    
    int distance, setPoint, errorVal, kp, speed, button ;        // Navigation variables
    
    int main()                                    // main function
    {
      setPoint = 32;                              // Desired cm distance
      kp = -10;                                   // Proportional control
    
      drive_setRampStep(6);                       // 7 ticks/sec / 20 ms
    
      while(1)                                    // main loop
      {
        distance = ping_cm(9);                    // Measure distance
        errorVal = setPoint - distance;           // Calculate error
       speed = kp * errorVal;                    // Calculate correction speed
    
        if(speed > 128) speed = 128;              // Limit top speed
        if(speed < -128) speed = -128;
    
        drive_rampStep(speed, speed);             // Use result for following
    
    
        // int button = sirc_button(10);
       while (1) <-- this is what is missing
        {
           int button = sirc_button(10);
    
          switch(button)   
        {
          case 2:
          wav_play("dontknow.wav");
          break;
    
          case 3:
          wav_play("thankyou.wav");
          break;
    
          case 4:
          wav_play("no.wav");
          break;
    
       }      // end switch
      }     
     }
     }      
    
    
    
    
    
    
    
    
    
     // if(button == 1)wav_play("Frosty.wav");
    
     //     if(button == 2)wav_play("Loveher.wav");   
      //    if(button == 3)wav_play("Meto.wav");                
      //    if(button == 4)wav_play("Michel.wav");                
      //    int     sirc_button (int pin)
    
    
    //   while(1)                                    // Repeat indefinitely
    //  {                                         
                                                  //  decoding signal from P10
     //   print("%c remote button = %d%c",          //  Display button # decoded
     //         HOME, sirc_button(9), CLREOL);     //  from signal on P10
    
     //   pause(100);    
    

    Mike

  • @iseries

    Thanks for helping me.
    The project do compile however the robot only goes straight foreward and
    will not respond to the sony remote and will not play any sound
    and also does not respond to ping.

    Thanks for your help

    siri

  • While I do not have your setup so debugging the code is difficult.

    Once you enter your second while loop it will loop there forever and wait for you to press a button (2, 3, or 4) and play a wave file that is indicated.

    Mike

  • @iseries

    Thank you for the help .

    siri

Sign In or Register to comment.