byte _DoubleToBytes_1_outArray[4];
unsigned long _stou1 = 0UL;
float _tempVariable_float;
void setup()
{
_startUart0();
_stou1 = millis();
}
void loop()
{
//Плата:1
_tempVariable_float = -12.5;
byte* _DoubleToBytes_1_tmp;
_DoubleToBytes_1_tmp = (byte*)(& _tempVariable_float);
_DoubleToBytes_1_outArray[0] = *_DoubleToBytes_1_tmp;
_DoubleToBytes_1_outArray[1] = *(_DoubleToBytes_1_tmp +1);
_DoubleToBytes_1_outArray[2] = *(_DoubleToBytes_1_tmp +2);
_DoubleToBytes_1_outArray[3] = *(_DoubleToBytes_1_tmp +3);
if (1)
{
if (_isTimer(_stou1, 1000))
{
Serial.println((((String(_DoubleToBytes_1_outArray[0], HEX))) + (String(",")) + ((String(_DoubleToBytes_1_outArray[1], HEX))) + (String(",")) + ((String(_DoubleToBytes_1_outArray[2], HEX))) + (String(",")) + ((String(_DoubleToBytes_1_outArray[3], HEX)))));
_stou1 = millis();
}
}
else
{
_stou1 = millis();
}
}
bool _isTimer(unsigned long startTime, unsigned long period)
{
unsigned long currentTime;
currentTime = millis();
if (currentTime>= startTime)
{
return (currentTime>=(startTime + period));
}
else
{
return (currentTime >=(4294967295-startTime+period));
}
}
void _startUart0()
{
int code= 6;
Serial.begin(9600, (_serialModeFromInt(code)));
}
int _serialModeFromInt(int code)
{
switch (code)
{
case 0x00: return SERIAL_5N1;
break;
case 0x02: return SERIAL_6N1;
break;
case 0x04: return SERIAL_7N1;
break;
case 0x06: return SERIAL_8N1;
break;
case 0x08: return SERIAL_5N2;
break;
case 0x0A: return SERIAL_6N2;
break;
case 0x0C: return SERIAL_7N2 ;
break;
case 0x0E: return SERIAL_8N2;
break;
case 0x20: return SERIAL_5E1;
break;
case 0x22: return SERIAL_6E1;
break;
case 0x24: return SERIAL_7E1 ;
break;
case 0x26: return SERIAL_8E1;
break;
case 0x28: return SERIAL_5E2 ;
break;
case 0x2A: return SERIAL_6E2;
break;
case 0x2C: return SERIAL_7E2;
break;
case 0x2E: return SERIAL_8E2;
break;
case 0x30: return SERIAL_5O1;
break;
case 0x32: return SERIAL_6O1;
break;
case 0x34: return SERIAL_7O1;
break;
case 0x36: return SERIAL_8O1;
break;
case 0x38: return SERIAL_5O2;
break;
case 0x3A: return SERIAL_6O2 ;
break;
case 0x3C: return SERIAL_7O2;
break;
case 0x3E: return SERIAL_8O2;
break;
}
return SERIAL_8N1;
}