Anyone work with Arduino

Gixxerfool

Well-Known Member
201
117
Where the weak are killed and eaten
Vehicle Model
Civic
Body Style
Coupe EX
So I am learning how to code for the Arduino. I am all self taught through YouTube videos, blogs and forums to help me along. I am currently hitting a roadblock. Anyone mess with these at all?
 
Only thing I've ever done is watch a bunch of coding videos for it due to interest in some projects people have done. I don't know that I'd be of much help. @ethlar may have messed with it? I could be wrong. What isn't going right, or what is the roadblock?
 
Only thing I've ever done is watch a bunch of coding videos for it due to interest in some projects people have done. I don't know that I'd be of much help. @ethlar may have messed with it? I could be wrong. What isn't going right, or what is the roadblock?

It's a timing issue from the best I can tell. I am trying to run leds in one direction. Sort of a one way Larson Scanner. I can get it to go up. It's the looping back around to start over that's the issue. I use the current LED position and have that increment to the next. So in effect it adds one. When I reach the end, it wants to keep incrementing. A Larson Scanner typically revereses. So you can decrement at the end. I have the typical Larson Scanner working. That was easy. Trying to modify it to do what I want is the issue.
 
i never dove too deep into the arduino, but post your code so we can see how youre doing it
 
i never dove too deep into the arduino, but post your code so we can see how youre doing it



byte ledPin[] = {2, 3, 4, 5}; // Define the pins on arduino
int ledDelay(250); // delay changes
int leddirection = 1;
int ledcurrentLED = 0;
unsigned long changeTime;


void setup() {
Serial.begin(9600);
for (int x=0; x<4; x++) {
pinMode(ledPin[x], OUTPUT); } // set all pins to output
changeTime = millis();
}


void loop() {
if ((millis() - changeTime) > ledDelay) { // if it has been ledDelay ms since last change
changeLED();
changeTime = millis();
}

}

// Increment Function to turn off all LED
void changeLED() {
for (int x=0; x<4; x++) { // Increment x++
digitalWrite(ledPin[x], LOW);
}

digitalWrite(ledPin[ledcurrentLED], HIGH); // Turning on the current LED
ledcurrentLED += leddirection; // increment the direction by value

// changing the direction if we reach the last LED
if (ledcurrentLED == 4) {leddirection = -1;}
Serial.print(" ledcurrentLED = "); Serial.println(ledcurrentLED); Serial.print(" leddirection = "); Serial.println(leddirection);
if (ledcurrentLED == 0) {leddirection = 1;}

}

It's pretty straight forward. The direction change is where I think I need to make my change. Any help would be appreciated.
 
is this kind of what you're trying to do...?

Go to like 5:17 into the vid. He has different versions of how slow/fast it moves earlier in the vid....


View: https://www.youtube.com/watch?v=khD59VExpp0


Sort of. Half of it. I want it to go one way then loop back to the beginning.

To give a little background I achieved this with hardware a while ago. Problem was it was too limiting and decided to off load it to an Arduino instead to match my other sketch. Unfortunately, life gets in the way and I haven't been able to touch it in months. So I am in the middle of shaking off the rust.
 
Last edited:
@webby essentially. Here's the rub, those are Neopixels. Those I have. In fact, I have those doing exactly what I need. The problem with those are they require a very specific timing instruction set that only work with them. That's what I first learn to write for. Let me see if I have video.


Here is a video of what I did, and I'm trying to do again, but this was all hardware.


Here is a complete video showing all the lighting in its Current stage. The three interior rings are all Neopixels. They're are done. Unless I start to think of fine tuning them more. I need to pick a place to call it done so I can move on with this project.

 
Last edited:
I guess I just don't follow what is wrong with your example vids? It's basically doing the same thing I posted in the videos above?
 
I guess I just don't follow what is wrong with your example vids? It's basically doing the same thing I posted in the videos above?

The Larson Scanner goes in a 0,1,2,3,4,5,4,3,2,1,0 fashion. The one I'm looking to do would be 0,1,2,3,4,5,0,1,2,3,4,5. Either way I think I found a fix. Thank you for your help.
 
glad you got it sorted, what is the whole project intended for?
 
I played with it for a while but haven't in a while.. Still have stuff somewhere.. That's pretty neat. I thought of using it for a retrofit headlight never did tho
 
Back
Top