Page 3 of 4

Re: few issues regarding NXT

Posted: 15 Jan 2011, 02:29
by muntoo
doc-helmut wrote:why RobotC and not NXC?
Ah, but that's just the language. What about the IDE? (Not that I'm against NXC :D .)
doc-helmut wrote: (exactly C to the ANSI C standard essentials is neither NXC nor RobotC: no pointers, no recursion, no stack, no heap, no stdio)
If you want those things, you can try nxtOSEK, but NXC is easier to set up, IMHO. (I still haven't figured out how to set up nxtOSEK.)

There's also leJOS, if you like the horrible language that is Java. BTW, have you heard this joke:

Knock knock
Who's there?
... [Very long pause]
Java.
goto jail;
... [Very long pause]
Sorry, that's illegal.

Re: few issues regarding NXT

Posted: 15 Jan 2011, 05:45
by mightor
The programming language bashing stops here. Either give useful info the OP asked for or go make your own thread.
Another thing: I read in one place that there may be some issues between robotC and the robot NXT-2.0 (download problem, etc ...). Is that correct or an old irrelevant information?
The brick is the same for the NXT 1.0 and 2.0 boxes. I have bricks from both the 1.0 and 2.0 sets and don't have any issues.

- Xander

Re: few issues regarding NXT

Posted: 15 Jan 2011, 11:03
by linusa
amitbr, I'd recommend "NXT Power Programming - Robotics in C" by John Hansen, 2nd edition: http://www.amazon.com/Lego-Mindstorms-N ... 0973864974

It uses NXC, which is similar to RobotC (as in: it's a C-dialect). It's free and possibly the most widely used language for NXTs (next to NXT-G of course).

Re: few issues regarding NXT

Posted: 16 Jan 2011, 05:50
by amitbr
Hi,

I spend yesterday a lot of time reading the great tutorial in robotc.net.
It really seems that someone invested a lot of time and effort on that and I am now confident it is a good language.

One question: Does ROBOTC supports all sensors and muxes? (color, engine mux, Gyro which I intent to use also)?
Is it a standard among the third party companies which produce hardware for NXT? Will they supply the need procedures?

thanks,
Amit

Re: few issues regarding NXT

Posted: 16 Jan 2011, 06:46
by mightor
One question: Does ROBOTC supports all sensors and muxes? (color, engine mux, Gyro which I intent to use also)?
Is it a standard among the third party companies which produce hardware for NXT? Will they supply the need procedures?
I have written a driver suite for ROBOTC which is also included with the installation (not always 100% up to date). You can download it from one of the links in my signature. It has drivers for pretty much every single sensor available on the market for the NXT and a couple of extra ones, too. My drivers are the official ROBOTC ones for HiTechnic and Dexter Industries. Although Mindsensors does produce their own drivers as well, my suite supports all of their sensors with the exception of the Sumo Eyes.

- Xander

Re: few issues regarding NXT

Posted: 22 Jan 2011, 20:11
by amitbr
Hi,

Can I find anywhere a robotC code that will operate the color ball sorter robot which its build instructions comes with the NXT 2.0 box?
I am referring to that one: http://www.youtube.com/watch?v=MSde6tvGn1s

In addition, where can I find a robotC example how to control the robot (even the most basic one) through keyboard? (activate motors)

thanks,
amit

Re: few issues regarding NXT

Posted: 23 Jan 2011, 13:02
by amitbr
anyone can answer please?
thanks,
amit

Re: few issues regarding NXT

Posted: 23 Jan 2011, 13:19
by mightor
I don't think you can control the robot through the keyboard in ROBOTC. You can use a joystick or one of those gamepads, though.

As for code for the 2.0 models, I'm afraid you'll have to make it yourself :) There is a good tutorial for ROBOTC, though. Just go to my website at the bottom of this message and look on the right side of the page.

The robotics academy also have some really good tutorials on their website. http://www.robotc.net/education/curriculum/nxt/

Also, check out the sample code that is shipped with ROBOTC. Just go to file->open sample program and pick one of the examples to look at. An older version of my driver suite is also included there. You can always download a more recent one from the link in my signature.

- Xander

Re: few issues regarding NXT

Posted: 23 Jan 2011, 15:09
by amitbr
Correct me if I am wrong, but in the NXT-G you can control the motors using the keyboard?

regarding the tutorial: I read it form start to end. It is good but basic (for someone who is familiar with programing).
One thing I did not see for example is how to read the color sensor (the examples there are for the light sensor only).
Is there an example for the color sensor also?

Thanks,
Amit

Re: few issues regarding NXT

Posted: 23 Jan 2011, 15:25
by mightor
You are not wrong, but ROBOTC just doesn't offer that ability, not through the keyboard anyway.

Here's a program to display the colour currently being detected by colour sensor.

Code: Select all

#pragma config(Sensor, S1,     colorPort,           sensorCOLORFULL)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
  string sColor;

  while (true) {
    switch (SensorValue[colorPort])
    {
      case BLACKCOLOR:    sColor = "Black";     break;
      case BLUECOLOR:     sColor = "Blue";      break;
      case GREENCOLOR:    sColor = "Green";     break;
      case YELLOWCOLOR:   sColor = "Yellow";    break;
      case REDCOLOR:      sColor = "Red";       break;
      case WHITECOLOR:    sColor = "White";     break;
      default:            sColor = "???";       break;
    }
    nxtDisplayCenteredTextLine(2, sColor);
    wait1Msec(50);
  }
}
Regards,
Xander