查了下,arduino官方对float的解释是If doing math with floats, you need to add a decimal point, otherwise it will be treated as an int. See the Floating point constants page for details.
如果用float运算,需要把所有的数都改成浮点进行运算,不然就会被当成int运算。如果你把1023.0的0去掉了,就是两个int运算。n*5/1023的值是个小于1的小数,arduino会直接把它当成0处理,所以结果现实的也就是0了。
和C语言的规则不太一样。