I2C commands

Post your NXJ projects, project ideas, etc here!

Moderators: roger, 99jonathan, imaqine

I2C commands

Postby robotnik » Thu Jan 24, 2013 9:18 am

Hi again,

I'm still playing with NXTCam, I tried to put a different firmware, using mindsensors tutorial ( http://www.mindsensors.com/index.php?mo ... ent_id=152 ), adding this

Code: Select all
else if ( (asciiTokenBuffer[0] == 'C') &&
              (asciiTokenBuffer[1] == 'O') )
   {
      /* the user wants to set registers in the OV6620 */
      receivedCmd = echoCmd;
   }


and
Code: Select all
   else if (receivedCmd == echoCmd)
   {
      UIMgr_txBuffer("CO R", 4);
                UIMgr_txBuffer("\r\n",2);
   }


So, if you send CO you should receive CO R<CR>ACK

It works when I send commands with TeraTerm, but not with NXT. How do you send and receive from I2C sensors?

Something like this?

String command_send = "CO";
buffcommand = command_send.getBytes();

I2Cport.i2cTransaction(I2Csensor.getAddress(), buffcommand, 0, 2, buffresponse, 0, 4);


or using I2CSensor senddata and getdata?

I2Csensor.sendData(int register, byte[] buf, int len);
I2Csensor.getData(int register, byte[] buf, int len);


Thanks!
robotnik
New User
 
Posts: 4
Joined: Tue Jan 15, 2013 10:33 am

Re: I2C commands

Postby gloomyandy » Thu Jan 24, 2013 12:26 pm

What firmware do you installed on the PIC processor on the NXTCam (the one that handle communication between the NXT and the NXTCam)? To use new commands you must have the generic firmware installed (not the standard firmware). This is all explained in the Mindsensors tutorials. Once you have that installed you then have to use a different command set that allows you to read and write a series of bytes to the NXTCam. Again this is provided in the Mindsensors tutorials.

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3012
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK


Return to NXJ Projects

Who is online

Users browsing this forum: Google [Bot] and 1 guest

more stuff