Skip to main content

Questions tagged [nxc]

Not eXactly C, or NXC, is a high-level programming language for the Lego Mindstorms NXT.

Filter by
Sorted by
Tagged with
3 votes
1 answer
322 views

Please help me: Sending String from PyCharm via usb to NXT, which is programmed by Bricx CC

I am new on this platform and hope for some help. I am doing a school project right now and we are working with Lego Mindstorms NXT and write the program with the Bricx Command Center. I know that ...
user25584917's user avatar
3 votes
1 answer
277 views

Mindstorms NXT NXC RemoteStopProgram fails compilation

I have two NXT bricks connected and they work together using Bluetooth, sending messages between the two works. The master NXT will start a program on the slave NXT with the RemoteStartProgram ...
Paul's user avatar
  • 31
1 vote
1 answer
288 views

Program for NXT golf robot not looping properly

This is what I made: I will put this robot straight in line with the ball I have to make this robot go forward and once it reaches the ball, I have to make it stop and hit the ball with the swing ...
HelpmePlz's user avatar
3 votes
1 answer
169 views

Get robot to face perpendicular to nearest object, using the ultrasonic sensor in NXC?

I have an ultrasonic sensor attached to a motor so that the sensor can rotate. Right now it stops once it scans a value less than 65 cm. What I want it to do is to scan its surroundings and then face ...
notexactlygoodatNXC's user avatar
1 vote
1 answer
126 views

How to send through Bluetooth motor angle position and mirror that position on another motor?

I've built a steering wheel that checks the servomotor position using NXC function - MotorRotationCount(). Now, I want to send that position to second brick using Bluetooth and apply that servomotor ...
Kacper Reicher's user avatar
1 vote
2 answers
1k views

How to flash a LEGO Mindstorms brick and program it in another language

I have a basic LEGO Mindstorms kit which I wanted to use for testing a very simple object-avoidance project. I am trying to find a relatively simple way to flash the brick and upload scripts to it ...
Nathan's user avatar
  • 111
2 votes
0 answers
89 views

How to pass an unknown type as a function parameter in NXC?

I was trying to do it as in a regular C, with void*, but it didn't work. Is it possible to pass it in NXC? If it is- how to do it?
elle's user avatar
  • 43
2 votes
1 answer
111 views

How to represent infinity in NXC?

Is there anything like Java's Float.POSITIVE_INFINITY in NXC? How else can one represent the positive infinity in NXC?
elle's user avatar
  • 43
3 votes
1 answer
184 views

Absolute position regulation NXC

I am trying to position the LEGO NXT motor exactly at a certain absolute angle: PosRegEnable (OUT_A); PosRegSetAngle (OUT_A, 0); Wait (500); // to read sensor value ...
vamshi krishna's user avatar
2 votes
0 answers
235 views

NXT (NXC) Programs are too slow

I am using Bricx Command Center to write some NXC code for a side project. I am working with the MindSqualls C# Library in Unity and am trying to figure out some ways to use the NXT robots in an event-...
Twon Johnson's user avatar
5 votes
2 answers
1k views

How to store a matrix of values and pick out certain elements and compute the difference?

I at the moment am trying to make an EV3 robot which is capable of following a gradient decent method. The idea was to store a discretized function in a 2D matrix, and make several lookups in that 2D ...
Bob Burt's user avatar
  • 151
2 votes
2 answers
460 views

Help with this .nxc Tripod program

I am getting a file error when I try to run this on my NXT 2.0. It's my first time using NXC and the program compiles and transfers fine... I tried replacing the batteries, the only other thing is ...
Timtech's user avatar
  • 814
2 votes
1 answer
905 views

"File error!" appears on NXT, but why?

I tried to upload this program to my NXT, but for some reason I am not able to run it properly as it is always terminated with the message File error!. No idea why. I am trying to read a .txt file ...
test's user avatar
  • 21
4 votes
1 answer
708 views

fgetc() moves pointer one step forward

I have opened a file using handle = fopen("rw.txt"). The file consist of 3 values which is separated with spaces ex: 12 23 34 using isspace(fgetc(handle)) Problem here is that fgetc() increments ...
test's user avatar
  • 91
3 votes
1 answer
133 views

identifier expected?

What identifier is expected here? #import "rw.txt" rw task main() { if(rw != NULL) { OnRev(OUT_A,75); Wait(100); } } Error: # Error: Identifier expected I don't seem to ...
test's user avatar
  • 91
2 votes
1 answer
490 views

Absolute Turning Motor in NXC

How can I turn my motor to 123 degrees, not for 123 degrees? I tried the PosRegSetAngle("output", "angle") command and didn't work. Documentation for PosRegSetAngle
Timbelion's user avatar
1 vote
1 answer
1k views

Raw RGB data to Color?

I'm trying to convert the raw RGB values from a Colour Sensor into HSL but it doesn't seem to be working: R = rgbn[INPUT_RED]; G = rgbn[INPUT_GREEN]; B = rgbn[INPUT_BLUE]; var_R = ( R/255 ); var_G = ...
Timbelion's user avatar
2 votes
3 answers
6k views

Programming NXT color sensor with NXC?

Currently I am working Lego robot that solves 2x2x2 Rubik's cube. I am programming Lego Mindstorms NXT 2.0 color sensor in BricxCC. I already have RGB data with the command ReadSensorColorRaw. I ...
Timbelion's user avatar
3 votes
1 answer
499 views

Connection between two NXT bricks

Is it possible send information from BrickNXT_A to BrickNXTB_B? For example I have a touch sensor connected to IN_1 of Brick_A and I want send the result of the sensor status (1 or 0) to Brick_B. If ...
FDuarte's user avatar
  • 395
5 votes
2 answers
1k views

How to turn the NXT at an angle with NXC

How can I program, with NXC, a Lego NXT to turn a specific angle? I've tried using wait() but the problem isn't solved. Can I use RotateMotor()? What parameters should I use? For example if I want ...
FDuarte's user avatar
  • 395
2 votes
1 answer
6k views

Programming EV3 with NXC

I'm trying to run NXC programs (all run well on NXT) but when trying run it on EV3 I find an error. The download from computer to EV3 runs well but trying to run the program with RUN EV3, I have an ...
FDuarte's user avatar
  • 395
2 votes
1 answer
550 views

Does NXC work with EV3? [duplicate]

Is it possible to create and run NXC programs on the EV3 brick? I installed BrixcCC, created a simple Hello World NXC program and selected "Download and Run" in the Compile menu. The EV3 brick made ...
Mikhail Glukhov's user avatar
5 votes
1 answer
2k views

How to use two NXT bricks for 3+ motors and 4+ sensors?

I need to use multiple bricks in order to use more motors and sensors. I need to read sensor values, and tell motors to move. I've tried using bluetooth, however my attempts haven't been very ...
user3089's user avatar
3 votes
1 answer
3k views

RGB sensor HOWTO use?

I've got an RGB sensor (this one with the three LED thingies) and wonder how to access it using NXC. I know I can SetSensorColorFull(IN_1); and then access it using ReadSensorColorEx or, for ...
mirabilos's user avatar
  • 133
4 votes
1 answer
2k views

How to locate objects, and move towards them, without pre-programming the path

So I need to find objects in an enclosed area, I have access to the standard set of NXT sensors, i.e. ultrasonic/light. However, the ultrasonic sensors seem to be very unreliable and erratic, in ...
user3089's user avatar
6 votes
1 answer
833 views

Is there a way to program the EV3 brick with NXC?

I tried to program the EV3 brick with NXC so i used BricxCC. The download of the program to the EV3 was successful but when i tried to start the program (which actually didn't show up on the program ...
Benjamin Minixhofer's user avatar
6 votes
1 answer
104 views

Accessing ARM Processor Memory Registers through NXC

Specific to the NXC (Not eXactly C) programming language. Is it possible to access the memory registers on the ARM AT91SAM7S256 processor? I'm trying to investigate the use of Timer Interrupts to ...
Mechatronica's user avatar
10 votes
1 answer
327 views

NXC Saturation algorithm for limiting motors?

What is a good algorithm in NXC for control saturation? I want to make sure my motors don't turn past a certain angle, or they will break the model. I could do something like: if (angle > 45) {...
Antonvh's user avatar
  • 331
9 votes
0 answers
334 views

PosRegEnable - How to change motor parameters? [closed]

I want to set PID parameters for a faster 'attack' when using PosRegEnablePID() on a motor. I am compiling with nbc/nxc 1.2.1 r4 mac osx fatbinary using -Z2 and -EF flags. But the compiler says: # ...
Antonvh's user avatar
  • 331