Changes between Version 2 and Version 3 of SPIMaster
- Timestamp:
- Feb 22, 2009 4:50:52 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SPIMaster
v2 v3 4 4 5 5 source:/arduino-spi 6 7 使い方の例。[http://japan.maxim-ic.com/quick_view2.cfm/qv_pk/3149 MAX6675冷接点補償K熱電対ディジタルコンバータ]から温度を読んでみました。 8 {{{ 9 #include "SPI.h" 10 11 #define SLAVE 10 12 13 void 14 setup() 15 { 16 Serial.begin(9600); 17 SPI_Master.begin(SLAVE); 18 } 19 20 void 21 loop() 22 { 23 delay(500); 24 long value; 25 SPI_Master.enable(SLAVE); 26 value = SPI_Master.read() << 8; 27 value |= SPI_Master.read(); 28 SPI_Master.disable(); 29 30 if ((value & 0x0004) != 0) 31 Serial.println("Error"); 32 else 33 Serial.println((float)(value >> 3) / 4); 34 } 35 }}} 36