Code does not execute

I am using making some sort of obstacle avoiding robot using ultrasonic sensors. It worked well until I added a function to the code. Then, it did not even start. The function is not called at the beginning of the code and it compiles successfully.

The weirdest thing is that I deleted the content of another function and found that the code started to run.

Comments

  • Perhaps you have run out of memory? More info is needed. Check for error messages when compiling code, and do some testing.Ultimately you may have to post the code.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • kwinn wrote: »
    Perhaps you have run out of memory? More info is needed. Check for error messages when compiling code, and do some testing.Ultimately you may have to post the code.

    I also think it is a memory problem but the code compiles with no error messages.
    Here is the code size.
    300 x 77 - 3K
  • What software are you using to compile and download the code?

    You can always compile and download a simple known working program (led blinker, hello world, etc.) to eliminate the PC, PC to Prop connection, and Propeller chip.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • I had a funny issue with my own Botto code and ultrasonic sensor...
    http://forums.parallax.com/discussion/167218/botto-a-walking-robot-with-3d-printed-parts-and-controlled-by-parallax-propeller-activity-board

    It turned out that, when I tried to clean up my code and remove debugging stuff, I was asking the sensor for updates too fast.

    You need to wait some time between asking the sensor for an update or it doesn't work and the driver stalls...
    Prop Info and Apps: http://www.rayslogic.com/
  • kwinn wrote: »
    What software are you using to compile and download the code?

    You can always compile and download a simple known working program (led blinker, hello world, etc.) to eliminate the PC, PC to Prop connection, and Propeller chip.

    I am using SimpleIDE.
    I tried a working program and it worked well.
  • omarmonzer wrote: »
    kwinn wrote: »
    What software are you using to compile and download the code?

    You can always compile and download a simple known working program (led blinker, hello world, etc.) to eliminate the PC, PC to Prop connection, and Propeller chip.

    I am using SimpleIDE.
    I tried a working program and it worked well.

    OK, so the problem is with the downloaded code. What I often do for this kind of debugging is to add a line at the beginning of each section and subroutine that outputs "Got to sub" to PST, where sub is the name of the section or subroutine.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • It worked when I tried to use a slightly simpler algorithm. I think the problem was that the micro controller ran out of ram so it messed up. Thank you very much @kwinn and @Rayman for your help.
Sign In or Register to comment.