문제

Is there any way to add any sort of debugging to a Lego Mindstorms program, when using the NXT drag-and-drop environment?

It would be nice to be able to monitor the status of the various sensors, but even knowing what step in the program was running would be nice.

도움이 되었습니까?

해결책

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

I found an example that walked thru the following steps:

  • add a loop
  • inside the loop, add a sensor
  • next, add a number to text control
  • add a display control
  • wire up the output of the sensor to the input of the number to text control
  • wire up the output of the number to text control to the display

Now, when you run it, the display will continually update with the values coming from the sensor.

So it's not a whole lot better than printf statements, but you know, I got a lot of programming done with that technique :)

다른 팁

I don't know if you can do it with the NXT environment, but you can use Java instead, and maybe there, you can do it. I bought a book a few years ago on the topic of developing for Mindstorms with Java. I never actually did anything with it though. I think it was this one: http://www.amazon.com/Programming-Lego-Mindstorms-Java-CD-ROM/dp/1928994555/ref=pd_bxgy_b_img_b Looks like they get into debugging, so that may be an option, if you were willing to get outside of the NXT environment. Looks like there's only one NXT book on the subject at Amazon, and it's not yet out, and wow - there are alredy some severely negative reviews. Not sure how that happens...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top