|NXT-G example program for NXT|
The following image shows simple NXT-G program which reads the strongest sensor and its value and displays them on the lcd screen.
Before you can start using NXT-G to write programs with the cball you must import the I2C communication blocks. To import these blocks you must have the Dynamic Block Update for NXT-G installed. To install the update and import the I2C block follow these instructions.
You are now ready to load the example cball software into NXT-G. Download the cballnxtg.zip file and unzip. Select the ‘File – Open’ option and browse to the directory where you saved the ‘cballnxtg.rbt’, select this file and select open. Your NXT-G will show the example NXT-G program.
The following image shows the setting in the IIC Read block required to read a value from the cball sensor. The default address 0xC0 is 192 in decimal. The full list of commands can be found in the digital command list.
You can also download, unzip and open cballnxtg2.zip which has a more advanced example. This example uses the switch and sound blocks to verbally indicate the strongest sensor.