Hi Kyle, Not sure I understand what you try to do exactly. You basically want to exchange messages between TinyOS and a Java application? What would be the main differences/challenges to the standard approach? http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder
The error message that you attached seems to indicate that the Java code could not connect to the SerialForwarder. Did you start a separate SerialForwarder process? Alternatively, you can connect directly to the serial port (without SerialForwarder). One way of doing this would be to create a PhoenixSource object with the right connection parameter (e.g. "serial@/dev/ttyUSB0:telosb"), with which you can then create a MoteInterface object. Cheers, Urs Kyle Fullerton wrote: > Hi all, > > I'm trying to create a computer-TelosB mote interface using the MoteIF > module as the basis for the computer-side code. However, I'm not sure what > code to run on the mote to allow it to send and receive messages. > > My original mote code used SerialActiveMessageC to communicate with a > Microsoft Visual C++ application, which worked well. Unfortunately, the > project now needs to run on a Linux machine, which can't use Visual C++. I > attempted to use the Send Java module included with the PrintfClient code, > because I assume that the Send module and the MoteIF module use the same > underlying software. When I try to send a message, using the format that > worked for the Visual C++ code, I get an exception (below). Might it be > because the SerialActiveMessageC is incompatible with Send/MoteIF? If so, > what should I use instead? > > It seems like it would be possible (but difficult) to use the printf library > and borrow some code from the PrintfClient Java module to allow the mote to > send data, but this still wouldn't help with the issue of computer-to-mote > communication. If anyone has written a mote-side module for this, or knows > where to find one, could you let me know? > > Thanks in advance, > > -Kyle Fullerton > > Result when sending a message: > pressureu...@pressurecomp:/media/UDISK/toto/BaseMoteCode$ java > net.tinyos.tools.Send 44 00 FF FF 00 00 08 00 02 00 03 15 00 00 04 01 > Exception in thread "main" java.net.ConnectException: Connection refused > at java.net.PlainSocketImpl.socketConnect(Native Method) > at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) > at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) > at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) > at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) > at java.net.Socket.connect(Socket.java:520) > at java.net.Socket.connect(Socket.java:470) > at java.net.Socket.<init>(Socket.java:367) > at java.net.Socket.<init>(Socket.java:180) > at net.tinyos.packet.SFSource.openSource(SFSource.java:56) > at net.tinyos.packet.AbstractSource.open(AbstractSource.java:69) > at net.tinyos.tools.Send.main(Send.java:41) > pressureu...@pressurecomp:/media/UDISK/toto/BaseMoteCode$ echo $MOTECOM > serial@/dev/ttyUSB0:tmote > pressureu...@pressurecomp:/media/UDISK/toto/BaseMoteCode$ motelist > Reference Device Description > ---------- ---------------- --------------------------------------------- > M4AIYE9Y /dev/ttyUSB0 Moteiv tmote sky > pressureu...@pressurecomp:/media/UDISK/toto/BaseMoteCode$ _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
