yuandi:diy:链接1

  1. const int ledPin = 12;
  2. int ledState = LOW;
  3. long previousMillis = 0;
  4. long interval = 1000;
  5. void setup() {
  6. pinMode(ledPin, OUTPUT);
  7. }
  8. void loop()
  9. { unsigned long currentMillis = millis();
  10. if(currentMillis - previousMillis > interval) {
  11. previousMillis = currentMillis;
  12. if (ledState == LOW)
  13. ledState = HIGH;
  14. else
  15. ledState = LOW;
  16. digitalWrite(ledPin, ledState);}}
  • yuandi/diy/链接1.txt
  • 最后更改: 2014/04/21 13:04
  • (外部编辑)