DineshP 0 Posted May 29, 2017 Share Posted May 29, 2017 I have a MSP430F5529 module and I have connected CC110 L module to it.. I have another CC3200 Module with CC110L. I wish to send the analog values measured by MSP430F5529 to the CC3200 through RF. Here is my transmitter code(MSP430F5539 and CC110L).. I tried to modify the existing Wireless example.. #include <SPI.h> #include <AIR430BoostFCC.h> #define CMD_OFF 0 #define CMD_ON 1 /** * sControl - control packet. */ struct sControl { unsigned char cmd1;unsigned char cmd; }; struct sControl txControl = { CMD_OFF }; // TX control packet struct sControl rxControl = { CMD_OFF }; // RX control packet int sensorpin=A0; int sensorvalue=0; int u=0,t=0,h=0; char ID[]="ABCD"; void printRxData() { // Print the last received command to the serial port. Serial.print("RX Command: "); Serial.println(rxControl.cmd1); } void setup() { Radio.begin(0x02, CHANNEL_1, POWER_MAX); Serial.begin(9600); pinMode(RED_LED,OUTPUT); } void loop() { if(Radio.receiverOn((unsigned char*)&rxControl,sizeof(rxControl),1000)>0) { if(rxControl.cmd==3) { digitalWrite(RED_LED,HIGH); sensorvalue=analogRead(sensorpin); sensorvalue=map(sensorvalue,0,4096,0,255); char ID[4]="C"; char b[4]; itoa(sensorvalue,b,10); strcat(ID,b); Serial.println(ID); Radio.transmit(ADDRESS_BROADCAST,(unsigned char*)&ID,sizeof(ID)); } digitalWrite(RED_LED,LOW); } } On My receiver side I have a CC3200 with a CC110L booster pack. When the receiver code sends a #include <SPI.h> #include <AIR430BoostFCC.h> // ----------------------------------------------------------------------------- /** * Defines, enumerations, and structure definitions */ #define CMD_OFF 0 #define CMD_ON 1 /** * sControl - control packet. */ struct sControl { unsigned char cmd1;unsigned char cmd; }; // ----------------------------------------------------------------------------- /** * Global data */ struct sControl txControl = { CMD_OFF }; // TX control packet struct sControl rxControl = { CMD_OFF }; // RX control packet int sensorpin=A0; int sensorvalue=0; int u=0,t=0,h=0; char ID[]="XXXX"; // ----------------------------------------------------------------------------- // Debug print functions void printRxData() { // Print the last received command to the serial port. Serial.print("RX Command: "); Serial.println(ID); } int i=0; void setup() { Radio.begin(0x02, CHANNEL_1, POWER_MAX); Serial.begin(9600); pinMode(RED_LED,OUTPUT); pinMode(GREEN_LED,OUTPUT); pinMode(YELLOW_LED,OUTPUT); digitalWrite(RED_LED,LOW); digitalWrite(YELLOW_LED,LOW); digitalWrite(GREEN_LED,LOW); } void loop() { txControl.cmd=i; Radio.transmit(ADDRESS_BROADCAST,(unsigned char*)&txControl,sizeof(txControl)); while (Radio.busy()); if (Radio.receiverOn((unsigned char*)&ID, sizeof(ID), 1000) > 0) { printRxData();digitalWrite(RED_LED,HIGH); } i++; if(i==4) { i=0; } } In receiver code I have a line txControl.cmd=i;.. When the value of i==3 it will ping the cc3200 transmitter to send the analog data back.. i=1 and i=2 are reserved for launchpads with MSP430G2553 and CC110L (They are working really fine).. But the MSP430F5529 is not sending the data back ... On t he Receiver side i will get the data in the format as A70 B30 C123 A is the Identity of the node and the numbers followed after that is the analog value of that node Please help Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.