Feb 19,2020
1,934 views
end-flag
  • Comments(1)
  • Likes(1)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
  • unsigned long prev = 0; bool osw = HIGH; //bool LED = LOW; void setup() { // pinMode(0, OUTPUT); // pinMode(1, OUTPUT); pinMode(0, INPUT_PULLUP); for( int i=1; i<13; i++) { pinMode(i, OUTPUT); } prev = millis(); } void loop() { unsigned long cur = millis(); if (cur - prev > 10) { bool sw = digitalRead(0); prev = cur; if (osw == HIGH && sw == LOW) { // if (sw != osw) { // LED = !LED; flash(); } osw = sw; } } void flash() { for ( int i = 15; i >= 0; i--) { int L = random(1, 13); // if (L == 2) L = 1; digitalWrite(L, HIGH); // turn the LED on (HIGH is the voltage level) delay(i); // wait for a second digitalWrite(L, LOW); // turn the LED off by making the voltage LOW tone(13, random(3000, 5000), i * 2); delay(15 - i); } noTone(13); }

    Reply
VOTING 1 votes
  • 1 USER VOTES
10.00
  • YOUR VOTE 0.00 0.00
Mairaj Ali
Engineer
  • 10
    design
  • 10
    usability
  • 10
    creativity
  • 10
    content
10.00
You may also like