Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
ඕනම රටකට සෙට් වෙන CV එකක්
ErMurazor
Updated:
Saturday at 9:50 AM
Hambantota
7 Acres Beachfront Land For Sell DownSouth , PerPerch Price 420 000
1024 Digital
Updated:
Wednesday at 11:57 AM
Baseus PI LITE INDOOR CAMERA
ErMurazor
Updated:
Oct 12, 2026
Ad icon
Colombo
Hard Disk For Sale
mazza
Updated:
Oct 10, 2026
land for sale
justasking
Updated:
Oct 10, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Arduino led running project help
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="malaka78" data-source="post: 18420324" data-attributes="member: 534291"><p>// A variable to set a delay time between each LED</p><p>int delayTime = 10;</p><p>// A variable to store which LED we are currently working on</p><p>int currentLED = 4;</p><p>// A variable to store the direction of travel</p><p>int dir = 1;</p><p>// A variable to store the last time we changed something</p><p>long timeChanged = 0;</p><p>// An array to hold the value for each LED pin</p><p><span style="color: Red">byte ledPin[] = {4, 5,6,7, 8, 9, 10, 11, 12, 13};</span></p><p>void setup() {</p><p>// Set all pins for OUTPUT</p><p><span style="color: red">for (int i=0; i<10; i++) {</span></p><p><span style="color: red">pinMode(ledPin<em>, OUTPUT);</em></span><em></em></p><p><em>}</em></p><p><em>// Record the time once the setup has completed</em></p><p><em>timeChanged = millis();</em></p><p><em>}</em></p><p><em>void loop() {</em></p><p><em>// Check whether it has been long enough</em></p><p><em>if ((millis() - timeChanged) > delayTime) {</em></p><p><em>//turn off all of the LEDs</em></p><p><em>for (int i=0; i<10; i++) {</em></p><p><em>digitalWrite(ledPin<em>, LOW);</em></em></p><p><em><em>}</em></em></p><p><em><em>// Light the current LED</em></em></p><p><em><em>digitalWrite(ledPin[currentLED], HIGH);</em></em></p><p><em><em>// Increase the direction value (up or down)</em></em></p><p><em><em>currentLED = currentLED + dir;</em></em></p><p><em><em>// If we are at the end of a row, change direction</em></em></p><p><em><em>if (currentLED == 9) {</em></em></p><p><em><em>dir = -1;</em></em></p><p><em><em>}</em></em></p><p><em><em>if (currentLED == 0) {</em></em></p><p><em><em>dir = 1;</em></em></p><p><em><em>}</em></em></p><p><em><em>// store the current time as the time we last changed LEDs</em></em></p><p><em><em>timeChanged = millis();</em></em></p><p><em><em>}</em></em></p><p><em><em>}</em></em></p><p><em><em></em></em></p><p><em><em><span style="color: Blue">meka knight rider LED system eka umbata uda highlight karapuwaata one ewa deela hada ganin. naethnam digi pin 4-13 ta resister ekka led hi karala mekama hadapan.</span></em></em></p></blockquote><p></p>
[QUOTE="malaka78, post: 18420324, member: 534291"] // A variable to set a delay time between each LED int delayTime = 10; // A variable to store which LED we are currently working on int currentLED = 4; // A variable to store the direction of travel int dir = 1; // A variable to store the last time we changed something long timeChanged = 0; // An array to hold the value for each LED pin [COLOR="Red"]byte ledPin[] = {4, 5,6,7, 8, 9, 10, 11, 12, 13};[/COLOR] void setup() { // Set all pins for OUTPUT [COLOR="red"]for (int i=0; i<10; i++) { pinMode(ledPin[i], OUTPUT);[/i][/COLOR][i] } // Record the time once the setup has completed timeChanged = millis(); } void loop() { // Check whether it has been long enough if ((millis() - timeChanged) > delayTime) { //turn off all of the LEDs for (int i=0; i<10; i++) { digitalWrite(ledPin[i], LOW); } // Light the current LED digitalWrite(ledPin[currentLED], HIGH); // Increase the direction value (up or down) currentLED = currentLED + dir; // If we are at the end of a row, change direction if (currentLED == 9) { dir = -1; } if (currentLED == 0) { dir = 1; } // store the current time as the time we last changed LEDs timeChanged = millis(); } } [COLOR="Blue"]meka knight rider LED system eka umbata uda highlight karapuwaata one ewa deela hada ganin. naethnam digi pin 4-13 ta resister ekka led hi karala mekama hadapan.[/COLOR][/i][/i] [/QUOTE]
Insert quotes…
Verification
Hathara warak wissa keeyada? (Hathara wadi karanna 20)
Post reply
Top
Bottom