Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


return codes of a shell command


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-13-2008, 05:31 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default return codes of a shell command

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 ?

Thank you.

Pascal.
__________________
Pascal
Reply With Quote
  #2 (permalink)  
Old 06-13-2008, 05:33 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,112
Default

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

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD
Reply With Quote
  #3 (permalink)  
Old 06-13-2008, 05:51 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default return codes of a shell command

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.

Thank you.
__________________
Pascal
Reply With Quote
  #4 (permalink)  
Old 06-13-2008, 06:00 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,112
Default

How does the "brick" conect to the desktop...?
perhaps it all can be done with serial com...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD
Reply With Quote
  #5 (permalink)  
Old 06-13-2008, 06:05 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,346
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

The Process object in my Threading library Threading library for optimising compiler is an enhanced Shell facility and has a property "LastExitCode" that returns the exitcode of the last app that it has run.
Reply With Quote
  #6 (permalink)  
Old 06-13-2008, 06:12 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,112
Default

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

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

Last edited by Cableguy : 06-13-2008 at 06:18 PM.
Reply With Quote
  #7 (permalink)  
Old 06-13-2008, 06:35 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default

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.

Thank you
__________________
Pascal
Reply With Quote
  #8 (permalink)  
Old 06-13-2008, 06:40 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,112
Default

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

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD
Reply With Quote
  #9 (permalink)  
Old 06-13-2008, 06:52 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,346
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Quote:
Originally Posted by Cableguy View Post
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
Reply With Quote
  #10 (permalink)  
Old 06-13-2008, 06:58 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,112
Default

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

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell command J12345T Questions & Help Needed 2 06-08-2008 09:49 AM
Can a sub return more than 1 value ? TWELVE Questions & Help Needed 13 05-28-2008 09:58 AM
Questions on shell command, and user event, and the 6.30 dan kabestan Questions & Help Needed 2 05-15-2008 06:45 PM
How to find out that Shell command has finished petrbury Questions & Help Needed 6 10-16-2007 07:20 PM
what are the codes for CR and LF? Stellaferox Questions & Help Needed 7 06-02-2007 07:15 PM


All times are GMT. The time now is 02:34 PM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0