ROBOTC.net forums
http://www.robotc.net/forums/

NXT Prototype board
http://www.robotc.net/forums/viewtopic.php?f=52&t=844
Page 1 of 1

Author:  nat1192 [ Wed Oct 22, 2008 5:06 pm ]
Post subject:  NXT Prototype board

I am not sure where to ask this, but does anyone know what we are allowed to put on the NXT protoboard from HiTechnic? I am tempted to put a second processor on there to allow for a separate logic unit.

Also, how would I interface with the board via RobotC. I would assume the use of I2C, but how.

Author:  Sunny1261 [ Wed Oct 22, 2008 8:00 pm ]
Post subject:  Re: NXT Prototype board

Your question would be better handled in the FIRST forums. There you can get an official answer.

Personally, I don't think a separate logic unit is allowed. Check in the rules though.

I would STRONGLY recommond going to the FIRST forums. But make sure you read through the forums first. I think this issue has been previously addressed.

Author:  Dick Swan [ Wed Oct 22, 2008 10:29 pm ]
Post subject:  Re: NXT Prototype board

I would expect the most likely use of the prototype board is to add additional sensors. It is a great board for addigin additional simple analog sensors and simple touch sensors.

There are snippets of code on the web that illustrate the use of the prototype board and wrap into a nice function that you can use.

Author:  Jeff McBride [ Thu Oct 23, 2008 1:36 am ]
Post subject:  Re: NXT Prototype board

Our prototype board showed up in the mail today. We created a simple touch sensor and hooked it to one of the digital pins.

Here is the sample code. When you press the touch sensor, NXT displays the decimal value of the pin that sensor is attached to:

Code:
task main()
{
    // I2C Byte pattern to set the digital IO pins for Input
    // Message Length: 3    Data: 02 4E 00    Return bytes: 0
    byte msgSetDigitalIOPins[] = { 3, 2, 0x4E, 0 };

    // I2C Byte pattern to read the digital 6 bit value
    // Message Length: 2    Data: 02 4C     Return bytes: 1
    byte msgReadDigitalValues[] = { 2, 2, 0x4C };
   
    byte retBytes[8];  // return (reply) bytes

    eraseDisplay();
    SensorType[S1] = sensorI2CCustom;
    sendI2CMsg(S1, msgSetDigitalIOPins, 0);  // Make sure all of the digital I/O pins are in INPUT mode.

    while (nI2CStatus[S1] == STAT_COMM_PENDING)
        wait1Msec(2);

    readI2CReply(S1, retBytes, 0);

    while (true)
    {
        sendI2CMsg(S1, msgReadDigitalValues, 1);

        while (nI2CStatus[S1] == STAT_COMM_PENDING)
            wait1Msec(2);

        if (nI2CBytesReady[S1] == 1)
        {
            readI2CReply(S1, retBytes, 1);

            nxtDisplayTextLine(1, "B: %d", (~retBytes[0]) & 0x01);
            nxtDisplayTextLine(2, "B: %d", (~retBytes[0]) & 0x02);
            nxtDisplayTextLine(3, "B: %d", (~retBytes[0]) & 0x04);
            nxtDisplayTextLine(4, "B: %d", (~retBytes[0]) & 0x08);
            nxtDisplayTextLine(5, "B: %d", (~retBytes[0]) & 0x10);
            nxtDisplayTextLine(6, "B: %d", (~retBytes[0]) & 0x20);
        }
        else
            nxtDisplayTextLine(2, "B: ERR");
    }
}

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/