[Tinyos-help] serial communication
mai naaom
me.magenta at gmail.com
Mon Jul 2 08:40:33 PDT 2007
hi
i wrote a code to receive packets from the serial port and set the received
data on the leds i used the hyper terminal to send the data on it ,this
code doesnt work
this the code
WHAT is wrong?
#include "SerialB.h"
module SerialBC {
uses interface Boot;
uses interface Leds;
uses interface Packet;
uses interface AMPacket;
uses interface Receive;
uses interface SplitControl as serialcontrol;
}
implementation {
message_t pkt;
bool busy = FALSE;
uint16_t data;
event void Boot.booted() {
call serialcontrol.start();
}
event void serialcontrol.startDone(error_t err) {
if (err == SUCCESS) {
}
else {
call serialcontrol.start();
}
}
event void serialcontrol.stopDone(error_t err) {
}
event message_t* Receive.receive(message_t* msg, void* payload, uint8_t
len){
if (len == sizeof(serialmsg)) {
serialmsg* btrpkt = (serialmsg*)payload;
call Leds.set(btrpkt->data);
}
return msg;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20070702/5f483e65/attachment.html
More information about the Tinyos-help
mailing list