|
|
发表于 2014-9-7 01:31:34
|
显示全部楼层
不知是那裡出了問題.
在 arduino.cc 中, WireWrite 的 Syntax http://arduino.cc/en/Reference/WireWrite
Wire.write(value)
Wire.write(string)
Wire.write(data, length)
是可以接受 string 參數的.
但在 Wire.h 當中,
- virtual size_t write(uint8_t);
- virtual size_t write(const uint8_t *, size_t);
复制代码
應該是不接受 string 的.
不過, 有一點要注意, syntax 當中的是 string, 而不是 String (class), 意義也有點不同.
基本上, 從庫的設計去看, 我不相信 Wire class 會接受 String 作參數, 因為 String 是一個比較耗資源, 較為高階的 class.
而 Wire 是低階的庫, 絕不應該會調用 String 的. 一般寫庫的人, 也盡量不會用 String class 的.
所以, 我相信 wire 應該不可能接受 String class 的參數.
當然, 這純粹是個人猜測, 如果它真的調用 String class......或許還是有可能吧.(但相信應該機會很微) |
|