Hi! I wont be perfectly helpful, seeing as I practically havent used C at all, but I can guide you in the right direction. Basically thiese are the steps: 1) Be able to read & write stream of bytes to/from your usb port in C 2) Implement base station mote in tinyos, which should be able to send Radio packages when it receives serial packages 3) Implement end point mote which should be able to blink when receiving packages 4) In C implement the serial comunication algoryhm used by tinyos
For starters I would suggest flashing base station mote with the sample software BaseStation which comes together with tinyos and the other mote with some sending software, like blinktoradio. For the first part - it should be quite easy, as the motes on usb connection are basically serial ports - just find any tutorial for reading and writing to serial ports in C and soo you should be able to print out in console everything that comes through. (Basestation should forward all packages received to serial port so you will see that it works) For the second part you should just look into the basestation code provided with tinyos, it does almost exactly the thing ou need - receives messages from pc and sends to the radio. For the third part look at BlinkToRadio sample - this code contains event when receiving radio signal that blinks the led. For the last part which will probably be the hardest - you will ghave to reimplement the java library located (at least on my computer) /opt/tinyos-2.1.1/support/sdk/java/net/tinyos/packet/Packetizer.java in C (basicalliy if you have different directory structure, replace opt/tinyos with your tinyos installation directory.) The sample files (BaseStation and BlinkToRadio) are located in /opt/tinyos-2.1.1/apps Sorry I couldn't provide you with specific C or TinyOS code, but this should definately make things clearer. On Tue, Nov 9, 2010 at 7:11 AM, Ibrahim Abbas <[email protected]> wrote: > Hi all, > > I want to write a simple blink app which is single hop based, that is base > station will recev the message from serial connection and will forward to > another mote which will blink on message reception. How to write the code in > c which will send message over serial port to base station (serially > connected to pc)? > If any one knows there how to use ncg or mig with c plz let me know. > > plz help asap. > > Any kind of help will be appreciated. > > many thanks in advance. > > waiting for ur early reply. > -- > Ibrahim Abbas > Research Assistant > CoNNekT Lab > School of Electrical Engineering and Computer Science > National University of Sciences and Technology > Islamabad, Pakistan > > Web: http://connekt.seecs.nust.edu.pk/people/ibrahim_abbas.html > > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > -- ---------------------------------- Krišjānis Nesenbergs _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
