arduino中有比int范围小的数据类型吗?
内存不够怎么办
unsigned char、byte、short等应该都比int范围小。
内存不够,指的是电脑内存不够还是?
byte、short
參考:
https://www.arduino.cc/reference/en/
Data Types
其中,要注意的 int 在不同的電板是不同的:
https://www.arduino.cc/reference/en/language/variables/data-types/int/
On the Arduino Uno (and other ATmega based boards) an int stores a 16-bit (2-byte) value.
This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1).
On the Arduino Due and SAMD based boards (like MKR1000 and Zero), an int stores a 32-bit (4-byte) value.
This yields a range of -2,147,483,648 to 2,147,483,647 (minimum value of -2^31 and a maximum value of (2^31) - 1).
内存不够 很可能是其他 library, 或者某些不恰當的做法造成的。
如果有錯誤訊息,其他人會更容易找出問題所在。