我正在尝试将数据读入 Node-RED 中的两个不同高斯。
我有这些流程:
在功能块中我有这些代码:
var lines = msg.payload.split('\r\n');
var adcValue = parseFloat(lines[0].split(':')[1]);
var temperature = parseFloat(lines[1].split(':')[1]);
msg.payload = adcValue, temperature;
return msg;
这些可以从下面的代码中得到证明,谁在我的STM32上闪烁。
if(converADC == 1){
rawValueconta = rawValue;
converADC = 0;
HAL_ADC_Stop_IT(&hadc3);
while(counter < 10000){
if(flag == 1){
flag = 0;
sprintf(msg, "ADC rawValue: %hu\r\n", rawValueconta);
HAL_UART_Transmit(&huart3, (uint8_t*) msg, strlen(msg), 100);
temp = ((float)(110-30)/ (float)(*(TS_CAL2)-*(TS_CAL1)))*(float)(rawValueconta-*(TS_CAL1))+(float)30;
sprintf(msg, "Temperature: %.2f\r\n", temp);
HAL_UART_Transmit(&huart3, (uint8_t*) msg, strlen(msg), 100);
HAL_ADC_Start_IT(&hadc3);
if(converADC == 1){
rawValueconta = rawValue;
}
}
}
}
}
converADC = 0;
我想获取一高斯的温度值和另一高斯的 adcValue。
我该怎么做?
谢谢你
如果您已经设置了两个输出,则需要向每个输出发送不同的消息(根据最后一行)
var lines = msg.payload.split('\r\n');
var adcValue = parseFloat(lines[0].split(':')[1]);
var temperature = parseFloat(lines[1].split(':')[1]);
adc_msg.payload = adcValue;
tmp_msg.payload = temperature;
return [adc_msg, tmp_msg];