Advertisement
Krzyspx

d1mini_2

Nov 27th, 2016
5,650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1.  // Note that this sketch uses LED_BUILTIN to find the pin with the internal LED
  2. int ledState = LOW;    
  3. unsigned long previousMillis = 0;
  4. const long interval = 1000;
  5.  
  6. void setup() {
  7.   pinMode(LED_BUILTIN, OUTPUT);
  8.    Serial.begin(115200);
  9. }
  10. void loop()
  11. {
  12.   unsigned long currentMillis = millis();
  13.   if(currentMillis - previousMillis >= interval) {
  14.     previousMillis = currentMillis;  
  15.     if (ledState == LOW)
  16.       ledState = HIGH;  // Note that this switches the LED *off*
  17.     else
  18.       ledState = LOW;   // Note that this switches the LED *on*
  19.     digitalWrite(LED_BUILTIN, ledState);
  20.     Serial.println("led port   " + String(LED_BUILTIN));
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement