How can you debug Lego Mindstorms programs?

Is there any way to add any debugging to the Lego Mindstorms program when using the NXT drag and drop environment?

It would be nice to monitor the status of various sensors, but even knowing which step in the program works, it would be nice.

+4
source share
2 answers

It turns out that this is possible in the NXT environment.

I found an example that went through the following steps:

  • add loop
  • inside the loop, add a sensor
  • then add the number to text control
  • add display control
  • connect the sensor output to the number input in the text control.
  • connect the number output to text control on the display

Now, when you run it, the display will be constantly updated with the values ​​coming from the sensor.

So this is not much better than printf statements, but you know, I got a lot of programming done using this technique :)

+5
source

I don't know if you can do this using the NXT environment, but you can use Java instead, and maybe you can do it there. A few years ago, I bought a development book for Mindstorms with Java. I did nothing with this at all. I think it was like this: http://www.amazon.com/Programming-Lego-Mindstorms-Java-CD-ROM/dp/1928994555/ref=pd_bxgy_b_img_b It looks like they get into debugging, so this might be an option if you want to go beyond the NXT environment. It seems that there is only one NXT book on this subject on Amazon, and it has not yet been published, and wow - there are some of the serious negative reviews. Not sure how this happens ...

+1
source

Source: https://habr.com/ru/post/1305365/