hi all.

this is a new thread for the
http://www.mail-archive.com/tinyos-help@millennium.berkeley.edu/msg13203.htmlsince
it became long. thank you to micfox
and Peter to notice my copy/paste mistake.

i successfully sent an 1d array from pc to a tmote sky (tiny1.1) using the
moteif java togheter with the mig interface.
the problem comes when i try to increase the size of the array: i always get
this message:java.lang.ArrayIndexOutOfBounds

what is the difference between a 1d array and a several dim array? why is
there a problem when send more than one. it is quite curious (and
annoying..). maybe the problem comes from my [hex = Integer.parseInt(b1.trim(),
16 /* radix */)] operation. the goal is to enter a string (hexadecimal code)
in a java app, and to send this string using moteif.

below are the two codes: 1dim and twodim

yours.

// dim1

   short[] Cmd = new short[1];
   protected RemoteController rc;
   int hex;

   String b1 = _byte1.getText();
   hex = Integer.parseInt(b1.trim(), 16 /* radix */);
   Cmd[0] = (short)hex;
   rc.sendCommand(Cmd);

with struct in header.h
   typedef struct SkyetekM1miniCommand
{
   uint8_t M1miniCmd[1];

}SkyetekM1miniCommand;

//*********************************************************
 // dim2
   short[] Cmd = new short[2];
   protected RemoteController rc;
   int hex;

   String b1 = _byte1.getText();
   hex = Integer.parseInt(b1.trim(), 16 /* radix */);
   Cmd[0] = (short)hex;
   Cmd[1] = (short)hex;
   rc.sendCommand(Cmd);

   with struct in header.h
   typedef struct SkyetekM1miniCommand
{
   uint8_t M1miniCmd[2];

}SkyetekM1miniCommand;
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to