Hi,
I have a hopefully a quick question with regards to the RAK4631->Solutions->GPS_Tracker example. The example has an RAK1906 3-axis acceleration sensor. This code works well, but I was wanting to add and additional I2C sensor RAK16000 to add voltage and current date to the LoRa packet. Unfortuntly, I ran into an issue when trying to integrate the example code for the RAK16000 into the GPS_Tracker code i.e. when I entered the following code info the “void tx_lora_periodic_handler(void)” function, the program papered to hang went trying to execute serial print with sensor value.
Serial.print("Shunt Voltage [mV]: "); Serial.println(shuntVoltage_mV);
Serial.print("Bus Voltage [V]: "); Serial.println(busVoltage_V);
Serial.print("Load Voltage [V]: "); Serial.println(loadVoltage_V);
Serial.print("Current[mA]: "); Serial.println(current_mA);
Serial.print("Bus Power [mW]: "); Serial.println(power_mW);
if I delete all serial print sensor value commands and convert values to string and then perform serial print (see code below) code works fine.
data = “shuntVoltage_mV = " + String(shuntVoltage_mV) + “mV”
+ " loadVoltage_V = " + String(loadVoltage_V) + “V”
+ " busVoltage_V =” + String(busVoltage_V) + “V”
+ " current_mA =" + String(current_mA) + “mA”
+ " power_mW =" + String(power_mW) + “mW”;
Serial.println(data);
Note:
I also tried to create my own function to read in the sensor values and call this within the “void tx_lora_periodic_handler(void)” function, but the call to my function didn’t work. I have a similar issue if I try to call my function within the “void loop()” function.
Is anyone able to explain why I cannot perform serial print sensor value command and/or create and call a function from within “void tx_lora_periodic_handler(void)” function?
If required I can provide the full code.
Any help would be appreciated.
Kind Regards
Greg