MathScript Block Released
news/
software/
NXT Repository/Programming/NXT-G/

Here’s a new NXT-G block I’ve written for mathematical expressions. The block let’s you wire up to 6 inputs (marked ‘A’ to ‘F’) and write a mathematical expressions (e.g. ‘(A-32)^5/3-B*C’) which can include math operators (+, -, *, /), modulo %, power ^ (only positive integer powers can be calculated) and as many brackets as you like. Notice that the NXT only supports integer math, so 1/2*(A-5)^2 will allways return 0 (since 1 is less then 2) while (A-5)^2/2 will return the correct value (rounded to nearest integer).
A sample program picture is found here.
A forum topic for questions on the new block is found here.
NOTE: this block uses advanced, and undocumented, VI scripting functions to generate efficient LV code encapsulated into an empty template implementation VI. I will post some explentations of the main code part soon.