Questions tagged [nxc]

The `nxc` tag is for 'Not eXactly C'.

The tag is for 'Not eXactly C'. This language is described at http://bricxcc.sourceforge.net/nbc/. Apparently, it is an "unofficial" language for the LEGO Mindstorms NXT.

27 questions
0
votes
0 answers

Calling NXC code and library from F#

There is a special function used in NXC called ReadColorSensorEx(): int ReadSensorColorEx ( const byte & port, int & colorval, unsigned int & raw[], unsigned int & norm[], int & scaled[] ) But I cannot use exactly the same function…
yusuf
  • 3,591
  • 8
  • 45
  • 86
0
votes
1 answer

NXC StrToNum always returns 0

I have a strange problem with NXC. I try to receive a message from android phone and convert the string to a int value. The problem is it's always 0 Thats just a test programm. so its very strange^^ // MASTER #define INBOX 0 string tmps1 =…
NsJn
  • 63
  • 1
  • 1
  • 4
0
votes
1 answer

reading the last line from a file in nxc

I am trying to find a way of reading the last line in a text file in NXC and return the numerical value within the file but if the value is negative it returns the value with a 0 at the beginning instead of -. I can loop through all the lines of…
0
votes
1 answer

Negative values returned from file in NXC

I am saving values to a .csv file in NXC(Not eXactly C) and then calling on them ata later point in time. The problem I am having is when calling any negative values back from a cell it is displayed as 0123 instead of -123 which is throwing all my…
0
votes
2 answers

Append char to string - the NXC language

I want to write myself a function similar to PHP's str_repeat. I want this function to add specified amount of characters at the end of string. This is a code that does not work (string argument 2 expected!) void chrrepeat(const char &ch, string…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
0
votes
0 answers

Semantic Analysis For Simple Compile-To-C Language

So I'm working on creating a simple, compile-to-C language that has syntax similar to Python. Here is some sample source code: # All comments start with pound signs # Integer declaration speed = 4 motor = 69.5 text = "hey + guys!" junk = 5 …
turnt
  • 3,235
  • 5
  • 23
  • 39
0
votes
1 answer

Change characters in string - Not Exactly C language

I need to change one character in string. In normal C, this is done simply by changing the offset: char string[]="Somestring"; string[1] = 'a'; //"Samestring" But in NXC such operation is not supported. So how do I change charecter on a string…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
0
votes
1 answer

Lego Mindstorms - Nondescript compilation Failure

I am trying to program Lego Mindstorms robot and having a problem with NXC. While compiling any program I get a compile error. For example: task main() { OnFwd(OUT_A, 100); OnFwd(OUT_C, 100); Wait(1000); Off(OUT_AC); } There is no error message…
0
votes
1 answer

Weird compiler errors on in Bricx command center

I have been working on a program to make a robot follow a sound, but I keep getting weird compiler errors. I'm guessing that I made some mistake that threw the compiler off the rails. #define TICKS_TO_SAMPLE 6 #define MS_TO_SAMPLE 100 #define…
0
votes
2 answers

How to reset a variable back to 0 after use in a loop in NXC

For some odd reason the variable "angle" will not reset back to 0 when the loop ends. All of the math is just calculating c = sqrt(a^2 + b^2 - 2abCos(theta)) the robot won't do all of the math in one line. In the full code a and b are both changing…
jrl98
  • 23
  • 3
-1
votes
1 answer

Lego Mindstorms NXT, NXC: Error in replacing elements in an array (no matter the dimension)

I tried to write a simple fifteen puzzle for the Lego Mindstorms NXT block using Bricx Command Center. But there's always the same problem. The elements of the array (no matter the dimension) won't change the second time. Here's the code that…
-3
votes
1 answer

Struct in NXC and F#

I have a question: There is such a struct function in NXC: struct colorType { int colorval; unsigned int rawRed; unsigned int rawGreen; unsigned int rawBlue; unsigned int normRed; unsigned int normGreen; unsigned int…
yeniden
  • 91
  • 1
  • 1
  • 7
1
2