I am using UART to send data from my ArduPilot Mega (APM) board to intel
mote2 board. I'm using UART2 of the basic connector set (31 pin) on imote2.
The transmit and receive lines of UART are connected to the in and out of
the APM board respectively. What I intend on doing is that the APM sends
data over the UART to imote which then transmits data to another imote
connected to PC (acting as base station). I'm using the following code for
sending data from UART to mote and then from mote to the other mote (in
other words the "send" code):
module SimpleC {
uses interface Boot;
uses interface UartByte;
uses interface Packet;
uses interface AMSend as ImgStatSend;
}
implementation {
message_t img_stat_msg;
norace img_stat_t img_stat;
img_stat_t *tx_data;
uint8_t byte;
uint8_t timeout = 25;
event void Boot.booted() {
call UartByte.receive(&byte, timeout); //receiving from uart i.e.
from APM
tx_data = (img_stat_t *)call Packet.getPayload(&img_stat_msg,
sizeof(img_stat_t));
img_stat.Byte = byte;
memcpy(tx_data, &img_stat, sizeof(img_stat_t));
call ImgStatSend.send(AM_BROADCAST_ADDR, &img_stat_msg, sizeof(img_stat_t));
//call UartByte.send( 0 );
}
event void ImgStatSend.sendDone(message_t* bufPtr, error_t error){
}
}
Now the mote has more than one uarts so my question is how do I tell the
mote to read from (let's say) UART2? What changes should I make in the code?
Also if someone thinks that the logic of my code could be wrong please let
me know. Any kind of information or advice is welcome.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help