thank you or your message yes, i had actually only copied the whole declaration in example A: short[] CmdArray = new short[1]; i was trying to send a 1dim array for a test.
On 6/20/07, Micfox Micfox <[EMAIL PROTECTED]> wrote:
It seems it has nothing to do with TinyOS but the java program errors.. How did you define CmdArray in example B? Have you specified the size of the array in Java code? >From: "julien falco" <[EMAIL PROTECTED]> >To: "TinyOs Help List" <[email protected]> >Subject: [Tinyos-help] sending array with moteif >Date: Wed, 20 Jun 2007 09:35:10 +0200 > >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 _________________________________________________________________ 与世界各地的朋友进行交流,免费下载 Live Messenger; http://get.live.com/messenger/overview
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
