Changes between Version 21 and Version 22 of wade/embedded/arduino/example/temp
- Timestamp:
- Jun 7, 2013, 11:17:19 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
wade/embedded/arduino/example/temp
v21 v22 538 538 }}} 539 539 540 = 程式十:按鍵輸入 = 541 {{{ 542 int led = 13; 543 544 int lighttpye = 0; 545 int switchbutton=1; 546 547 void setup() { 548 pinMode(2, INPUT); 549 digitalWrite(2, HIGH); 550 Serial.begin(9600); 551 pinMode(led, OUTPUT); 552 } 553 void loop() { 554 555 int input1 = digitalRead(2); 556 Serial.println(input1); 557 delay(300); 558 559 if(switchbutton!=input1){ 560 if(input1!=0){ 561 if(lighttpye!=0){ 562 digitalWrite(led, HIGH); 563 lighttpye=0; 564 }else{ 565 digitalWrite(led, LOW); 566 lighttpye=1; 567 }} 568 569 switchbutton=input1; 570 571 } 572 } 573 }}} 574 540 575 [[Image(LED8x8-2.png)]]