hi all,

i am trying to send an array using moteif. i have successfully sent a short
(example A), and then i modified my code (example B) to send an array. but i
always get this error:
java.lang.ArrayIndexOutOfBoundsException: 1
Array:[EMAIL PROTECTED]
i dont know what i did wrong. i have simply put the same value in the array.
it seems like there is  problem at the array side. is it a good idea to send
an array? should i define 10 short instead of an array of size 10?

thanks in advance for you help!

_____________________
example A: working

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

   ...


public void justdoit(){

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

       } catch (Exception ex)

       {
           System.out.println(ex);
       }

using mig with this struct
typedef struct SkyetekM1miniCommand
{
   uint8_t M1miniCmd;


}SkyetekM1miniCommand;
_____________________________________
example B: not working

   public void justdoit(){

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

       } catch (Exception ex)

       {
           System.out.println(ex);
       }

using mig with this struct
typedef struct SkyetekM1miniCommand
{
   uint8_t M1miniCmd[1];

}SkyetekM1miniCommand;
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to