Loginskip to content

NXT Repository/Programming/NXT-G/

Special category for “native” new NXT-G blocks (written using LV & NXTToolkit) and contributed MyBlocks. See this page for a table of all available blocks.

Search under this category:

Sub-categories:

Contributions:

HiTechnic Acceleration Sensor NXT-G Block

Last update: Friday, March 9th, 2007

HiTechnic has released the NXT-G block for the Acceleration Sensor. Plugs are Port, X axis coordinate, Y axis coordinate, Z axis coordinate, Yes/No logic value, Trigger Point, and Greater-than/Less-than.

HiTechnic Color Sensor Block

Last update: Saturday, February 10th, 2007

The Color Sensor Block adds support for all Color Sensor features to the LEGO MINDSTORMS NXT Software. This block gives access to features enabling access to Color number, Red, Green and Blue relative color content, and in/out of color range.

HiTechnic Compass Sensor Block

Last update: Saturday, February 10th, 2007

The Compass Sensor Block adds support for all Compass Sensor features to the LEGO MINDSTORMS NXT Software.  This block gives access to features enabling Compass calibration, target heading and in/out of range and others. 

HiTechnic Gyro NXT-G block

Last update: Sunday, August 5th, 2007


This NXT-G block allow you to read degrees per second of rotation using HiTechnic Gyro sensor.

I2C Read/I2C Write General Purpose NXT-G Blocks

Last update: Saturday, February 10th, 2007

These two NXT-G blocks published on mindsensors.com website allow low-level I2C read and write operations from within NXT-G.

Line Following NXT-G Block

Last update: Saturday, February 10th, 2007

This block should be placed in a loop, and will cause drive the motors at the speed specified, so the robot can follow the edge of a line, with a single light sensor.

Mask Block for NXT-G

Last update: Saturday, February 24th, 2007

Michael Gasperi created a mask block for NXT-G. This block does bitwise AND between the input (A) and the mask. This is very useful when working with low-level I2C calls where usually each bit means something else…

Download the block from Michael’s site here.

MathScript Block Released

Last update: Monday, October 22nd, 2007


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.

Memory Level Block

Last update: Thursday, March 22nd, 2007

Here’s a NXT-G sensor block that returns available Flash memory
(in bytes).

Download block here.

Guy Ziv

MinMax NXT-G Block

Last update: Sunday, March 18th, 2007

This small NXT-G allows to get the maximal and minimal value of some varying input. This can be done with NXT-G MyBlocks using variables, but then you can’t easily place more then one such MyBlock in your program (unless you duplicate the block, changing the variable names..). As seen in the above sample code, the MinMax block usually should reside in a loop, and must be “Reset” at the first loop iteration (here I compare the counter to zero). Also, make sure that the input you put in is stable at the first iterations. For example, for the US measurement above I have another Distance Sensor block before the loop to ensure the sensor has enough time to produce meaningful output at the first iteration (otherwise I got maximal distance of 100 inches regardless of what I tried to do to the US sensor…). The block can be downloaded here.

Motor Power Meter NXT-G Block

Last update: Sunday, March 18th, 2007

This block is a “sensor” which allows you to monitor the actual power sent to the NXT servo motor. In a single motor mode (Motor block) with “Motor Power” enabled the firmware automatically increases the power to keep constant speed. Monitoring the ”Actual Power” allows detecting stall conditions as well as slip conditions (e.g. when your robot hits the wall, its motors might still be able to slip in place but the robot does not move). The former condition can be detected using encoders (as previously shown by Brian Davis and Dick Swan), but slipping can’t. Nevertheless, the actual power during slipping will be larger then the set power. The same goes for 2 motor “Move” command.

Usage: look for the typical min/max value of Actual Power during regular operation. Use the previously published MinMax Block to do this. Then set the threshold to a value larger then the maximal value rechieved during operation (I found 10-15% extra power is sufficiently discriminating and gives little false positive readouts). You can also monitor the difference (i.e. Actual Power - Set Power). Complete stall conditions for a single motor (with Motor block) are detected as “Actual Power” > 99.

NOTE: The NXT internal Power values are signed, where the sign defines the direction of motion. This block ignores the sign and allways returns positive values.

Download the block here.

MotorMux NXT-G Block

Last update: Saturday, February 10th, 2007

NXT-G Block for mindsensors.com motor multiplexer (MOTORMX-Nx).

PCF8574 Kit NXT-G block

Last update: Sunday, April 15th, 2007

Mindsensors.com released this NXT-G block to communicate with the PCF8574-Nx solder-it-yourself prototyping sensor. This IC gives 8 digital inputs/outputs.

Pneumatic Pressure Sensor NXT-G Block

Last update: Wednesday, February 14th, 2007

NXT-G Block for mindsensors.com Pneumatic Pressure Sensor (PPS35-Nx).


Any additions/suggestions/comments? Send an email to repository@nxtasy.org.