Hello everybody
On the desktop, with the "shell" command, I can execute a dos command.
How can I do to set a B4PPC variable with the return code of this dos command ?
Not sure WE understand what you mean..
can you give an example of what you want to do and expect from it?
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
My Posts helped you? Consider Buying me a Porto Glass!
Here are the details you ask :
I would like to use B4PPC to command a lego robotic brick, the "Mindstorms RCX 2.0".
I've found on the web, a program called "nqc" that can send commands to the lego brick by typing dos commands.
For exemple the command "c:\nqc.exe -Susb -raw 5103" makes the brick play the internal sound number 3.
Another example, the command "c:\nqc.exe -Susb -raw 2181" makes the brick start the motor number 1.
My problem is that other commands get the value of a sensor that is connected on the brick.
For example, the command "c:\nqc.exe -Susb -raw 120901", when I type it in a dos window returns the value of sensor number 1.
In B4PPC, I would like to put this return value in a variable.
How does the "brick" conect to the desktop...?
perhaps it all can be done with serial com...
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
My Posts helped you? Consider Buying me a Porto Glass!
The Process object in my Threading library http://www.basic4ppc.com/forum/addit...-compiler.html is an enhanced Shell facility and has a property "LastExitCode" that returns the exitcode of the last app that it has run.
yes, but from what I could google about mindstorms, there are a few ocx, and .net based dll, so a wrapper should sufice, thus making the need of shell obsolete....
And far better performance I think...
Here's one:
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
My Posts helped you? Consider Buying me a Porto Glass!
The Mindstorms brick I have is the old one, the RIS 2.0, and not the new one (NXT).
The line between the brick and the PC is infrared : an infrared sender is connected to one usb port of the PC.
I agree with Cableguy, concerning the low performance of the shell commands, but I personnaly don't know how to do a "wrapper", I only know B4PPC, So I'll try with shell commands.
since you are using an IR tower, it must have a com port assigned to it, then the rest should be "normal" serial comunication...
I found alot of info about mindstorms and .net, also some sets of command and relations....
Nothing like an hands-on aproach to see if it works...
use one of the serial IR examples to send a simple, ON/OFF command and see if it works...
If so, build on it...
PS.I wish I had one of those to play with....
perhaps if you decide to upgrade to the new version...argh just daydreamming
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
My Posts helped you? Consider Buying me a Porto Glass!
since you are using an IR tower, it must have a com port assigned to it
I don't think it does. I believe that it requires its own USB driver to be installed and my guess would be that it is an HID (Human Interface Device) device (like a keyboard or mouse) as this is an easy way to interface a slow(ish) speed device to USB without writing a complicated driver as Windows already has a generic HID driver available. The interface is by File I/O calls and calls to a Windows dll - HID.DLL
continuin googling I found that RIS2.0 should have come with, msot probably, a CD with some software, including .NET runtimes (DLL's)...
If this is to be true, then one of two things are true..
They(the dll's) run from B4PPc or need a wrapper...
The IR tower, as far as I could figure, is standart issue in RIS2.0
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
My Posts helped you? Consider Buying me a Porto Glass!