开发者

Simultaneously bluetooth remote (android) and run program

I'm a student on a hogeschool in the Netherlands. We're working with the LEGO Mindstorms NXT for a project.

However, I'm using my phone (minddroid and other applications) to drive the NXT, but I don't know how to simultaneously run a program.

For example, I dri开发者_如何学运维ve it over a black line with the remote, and because the program is running, the sensor sees in the program that if it drives over a black line, it has to stop.


Is your question how to get the NXT to both communicate on bluetooth and monitor the line at the same time? If so:

Then there are two general solutions:

Main Loop

In your main loop, first check for communications from the bluetooth system, and then check the sensor to see if the black line is detected. Then repeat.

Interrupt

In this solution, the main process would handle communications with the Android phone. The line sensor would be setup to cause a program interrupt when it detects the black line.

The interrupt service routine (ISR) would either set a flag to indicate that the robot should stop or would directly stop the robot.

Choosing which of the above solutions you choose is often dependent on the features of your operating system.

PS It could also be that I'm not understanding your question correctly. In that case, never mind...


No I meant that I wanted to run a program simultaneously with the bluetooth remote. But I solved it, I connected the nxt with a mobile app, so I could only send direct commands. I solved it by connecting with the program, not the nxt robot.

Thanks anyway!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜