hey all,
I am working on project with two CC1310 ( TX and RX) and Grove-LCD RGB backlight working with Energia, and i have downloaded their library. i have an issue with the LCD, the issue is the LCD does not show to me the float numbers (number after the decimal point) , so what i think there is a specific code that make the floating number shows on the LCD. i attached the codes for TX and RX and also i attached the picture of is working with me now.
thanks,
/*
EasyLinkRx
A basic EasyLink Receive example..
Receive a packet and print the 16-bit value stored in the payload.
This Sketch is the counterpart of teh EasyLinkTx example.
Hardware Required:
CC1310 LaunchPad
This example code is in the public domain.
*/
#include "EasyLink.h"
#include <wire.h>
#include "rgb_lcd.h"
rgb_lcd lcd;
const int colorR = 255;
const int colorG = 30;
const int colorB = 6;
EasyLink_RxPacket rxPacket;
EasyLink myLink;
void setup() {
//Serial.begin(115200);
// begin defaults to EasyLink_Phy_50kbps2gfsk
lcd.begin(16, 2);
myLink.begin(EasyLink_Phy_625bpsLrm);
Serial.println(myLink.version());
lcd.setRGB(colorR, colorG, colorB);
lcd.clear();
lcd.setCursor(4, 0);
//Print a message to the LCD.
lcd.print("Recovery");
lcd.setCursor(5, 1);
lcd.print("System");
delay (2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Owned by:Jornada");
lcd.setCursor(0, 1);
lcd.print("Exp. Range");
delay(4000);
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Built By");
lcd.setCursor(3, 1);
lcd.print("NMSU-ECE Dept");
delay(4000);
lcd.clear();
}
uint16_t value;
uint8_t address;
void loop() {
// Wait / block for 2 second to receive a packet.
// rxTimeout is in Radio time and needs to be converted from miliseconds to Radio Time
rxPacket.rxTimeout = EasyLink_ms_To_RadioTime(2000);
// Turn the receiver on immediately
rxPacket.absTime = EasyLink_ms_To_RadioTime(0);
EasyLink_Status status = myLink.receive(&rxPacket);
if (status == EasyLink_Status_Success) {
memcpy(&value,&rxPacket.payload[0], sizeof(uint16_t));
//lcd.print("Packet received with lenght ");
lcd.setCursor(0,0);
lcd.print("North: ");
lcd.print(rxPacket.payload[0]);
memcpy(&address,&rxPacket.payload[1], sizeof(uint8_t));
lcd.setCursor(0,1);
lcd.print("East:");
lcd.print(rxPacket.payload[1]);
delay (2000);
lcd.clear();
}
else {
lcd.print("Error receiving packet with status code: ");
//lcd.print(status);
//lcd.print(" (");
//lcd.print(myLink.getStatusString(status));
//lcd.println(")");
}
delay(1000);
lcd.clear();
}
_______________________
/*
EasyLinkTx
A basic EasyLink Transmit example..
Read the analog value from A0 (pin 2) and copy the value into the tx packet.
This Sketch is the counterpart of teh EasyLinkRx example.
Hardware Required:
* CC1310 LaunchPad
This example code is in the public domain.
*/
#include "EasyLink.h"
EasyLink_TxPacket txPacket;
EasyLink myLink;
void setup() {
Serial.begin(115200);
// begin defaults to EasyLink_Phy_50kbps2gfsk
myLink.begin(EasyLink_Phy_625bpsLrm);
Serial.println(myLink.version());
// Set the destination address to 0xaa
txPacket.dstAddr[0] = 0xaa;
}
float x = 32.281062;
float y = 106.753838;
void loop() {
uint16_t value[3]= {y};
uint8_t address= {x};
uint32_t xbee= 16;
// Copy the analog value into the txPacket payload
memcpy(&txPacket.payload[0], &value, sizeof(uint16_t));
memcpy(&txPacket.payload[1], &address, sizeof(uint8_t));
// Set the length of the packet
txPacket.len = sizeof(uint16_t);
// Transmit immediately
txPacket.absTime = EasyLink_ms_To_RadioTime(0);
EasyLink_Status status = myLink.transmit(&txPacket);
if(status == EasyLink_Status_Success) {
Serial.println("");
//uint8_t address= {9} ;
// Set the length of the packet
txPacket.len = sizeof(uint8_t);
// Transmit immediately
txPacket.absTime = EasyLink_ms_To_RadioTime(0);
EasyLink_Status status = myLink.transmit(&txPacket);
Serial.print("NEWVALUE");
Serial.print(address);
}
else {
Serial.print("Transmit failed with status code: ");
Serial.print(status);
Serial.print(" (");
Serial.print(myLink.getStatusString(status));
Serial.println(")");
}
delay(1000);
}