且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Arduino上将整数/小数转换为十六进制?

更新时间:2023-11-11 20:50:34

此处 .下面的代码是从该示例中提取的.

Take a look at the Arduino String tutorial here. The code below was taken from that example.

// using an int and a base (hexadecimal):
stringOne =  String(45, HEX);   
// prints "2d", which is the hexadecimal version of decimal 45:
Serial.println(stringOne);  

该页面上还有许多其他示例,尽管我认为对于浮点数,您必须自己滚动.

There are plenty of other examples on that page, though I think for floating point numbers you'll have to roll your own.