Quantcast
Channel: Arduino Forum - Latest topics
Viewing all articles
Browse latest Browse all 15404

How to refractor this one. Digital Counter ?

$
0
0

Hello,

I follow this course : https://www.youtube.com/playlist?list=PLGs0VKk2DiYw-L-RibttcvK-WBZm8WLEP

on lesson 5 I had to make a digital counter with led's.

So I did it this way

loop() {

  // 1 = 1 
  digitalWrite(greenPin1, low);
  digitalWrite(greenPin2, low);
  digitalWrite(greenPin3, low);
  digitalWrite(greenPin4, High);

  //  2 = 2 
digitalWrite(greenPin1, low);
  digitalWrite(greenPin2, low);
  digitalWrite(greenPin3, High);
  digitalWrite(greenPin4, low);

  ....

is there a better way to make this work so it counts to 15 without a lot of the same code.

and if so , can someone explain to me how that code works ?

4 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 15404

Trending Articles