I want to do two way communication between labview and arduino. For that I am using easy transfer Library which is really helpful. This library work like polling mechanism for eg: if there is any received data then send it.
I am able to communicate arduino with switch and sensor only when I comment the Send_SensorData function in loop. When I am uncommenting it it does not receive anydata. I don't know what is the problem. Is there any clock issue between arduino and sensor.
Here is the snippet of my code`
//create two objects
EasyTransfer Msgin, Msgout;
//give a name to the group of data
RECEIVE_DATA_STRUCTURE rxdata;
SEND_DATA_STRUCTURE txdata;
static long CycleTime = 10;
static boolean rgb_state = true;
static unsigned long start_time;
void loop() {
if (Msgin.receiveData()) {
// Start only once to start cycle time
if (rxdata.command == RGB_Sensor_Cycle_Time) {
CycleTime = rxdata.data;
}
Send_SensorData(); // Uncomment: command will not be received from LV and if commented reception of command.
}
void Send_SensorData() {
uint16_t red, green, blue, c;
unsigned long current_time;
unsigned long elapsed_time;
I want to do two way communication between labview and arduino. For that I am using easy transfer Library which is really helpful. This library work like polling mechanism for eg: if there is any received data then send it.
I am able to communicate arduino with switch and sensor only when I comment the Send_SensorData function in loop. When I am uncommenting it it does not receive anydata. I don't know what is the problem. Is there any clock issue between arduino and sensor.
Here is the snippet of my code` //create two objects EasyTransfer Msgin, Msgout;
//give a name to the group of data RECEIVE_DATA_STRUCTURE rxdata; SEND_DATA_STRUCTURE txdata;
static long CycleTime = 10; static boolean rgb_state = true; static unsigned long start_time;
void loop() {
if (Msgin.receiveData()) {
// Start only once to start cycle time if (rxdata.command == RGB_Sensor_Cycle_Time) { CycleTime = rxdata.data;
Send_SensorData(); // Uncomment: command will not be received from LV and if commented reception of command. }
void Send_SensorData() {
uint16_t red, green, blue, c; unsigned long current_time; unsigned long elapsed_time;
current_time = millis(); elapsed_time = current_time - start_time;
if (elapsed_time >= CycleTime && rgb_state == true ) { //&& rgb_state == false
} } `