2015年12月7日 星期一

02160234_洪振瑋 week13


(1)這周利用按扭來做短路功能
         用範例檔案來測試

開始執行時 會一直跑111111111111111111111111111111111

當按下按鈕後 短路變成00000000000000000000000000

----------------------------------------------------------------------------------------

(2)配合PORCESSING的範例
 Libraries->serial->SimpleRead

複製 loop迴圈到Arduino中

Setup 中 要改 "COM4"


void loop() {
           if (digitalRead(2) == HIGH) 
                        {  // If switch is ON,
                                  Serial.write(1);               // send 1 to Processing
                         } 
            else 
                        {                               // If the switch is not ON,
                                   Serial.write(0);               // send 0 to Processing
                         }
                delay(100);                            // Wait 100 milliseconds
             }

執行原本是灰色
按下按鈕後會變黑色!!!!
切換切換

沒有留言:

張貼留言