Changes between Version 13 and Version 14 of wade/embedded/arduino/example/temp


Ignore:
Timestamp:
Jun 6, 2013, 1:33:35 PM (11 years ago)
Author:
wade
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • wade/embedded/arduino/example/temp

    v13 v14  
    435435}
    436436}}}
     437
     438= 程式六:七段顯示器 =
     439{{{
     440void setup()
     441{
     442  pinMode(2, OUTPUT);
     443  pinMode(3, OUTPUT);
     444  pinMode(4, OUTPUT);
     445  pinMode(5, OUTPUT);
     446  pinMode(6, OUTPUT);
     447  pinMode(7, OUTPUT);
     448  pinMode(8, OUTPUT);
     449  pinMode(9, OUTPUT);
     450  clean();
     451}
     452
     453void loop()
     454{
     455  all();
     456  delay(500);
     457  clean();
     458  delay(500);
     459}
     460
     461void all()
     462{
     463  digitalWrite(2, HIGH);
     464  digitalWrite(3, HIGH);
     465  digitalWrite(4, HIGH);
     466  digitalWrite(5, HIGH);
     467  digitalWrite(6, HIGH);
     468  digitalWrite(7, HIGH);
     469  digitalWrite(8, HIGH);
     470  digitalWrite(9, HIGH);
     471}
     472
     473void clean()
     474{
     475  digitalWrite(2, LOW);
     476  digitalWrite(3, LOW);
     477  digitalWrite(4, LOW);
     478  digitalWrite(5, LOW);
     479  digitalWrite(6, LOW);
     480  digitalWrite(7, LOW);
     481  digitalWrite(8, LOW);
     482  digitalWrite(9, LOW);
     483}
     484}}}
     485