Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: KsKBeko on Apr 15, 2019, 06:21 pm

Title: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: KsKBeko on Apr 15, 2019, 06:21 pm
Hi dear community;

i have 4 x MAX7219 Module with Arduino Uno.

i was found some scrolling text examples for MAX7219 Module on internet, then i run it without any problem but i want to make 2 change on project.

This is the code what i run without any problem;

(Thus 9000 character limit of this post i cannot paste the code here as text)


 
1-) i added two 10k potentiometer to breadboard and added code to IDE to adjust scroll speed and brightness.
POT's are works but problem is; when you adjust the POT, scroll speed or brightness on the MAX7219 doesnt change until next loop.
İs there a way to adjust instantly ? so i dont have to wait untill next loop of code ?


This is my POT added code later on



And this is the video of what happening

https://youtu.be/wso0ny1WRPA (https://youtu.be/wso0ny1WRPA)




2-) How to add specific pattern to char list ? e.g a Heart or Smile pattern.
I simply tired to modify one of the current byte array like; #
but i could not able to use 8x8 fully because byte array in this set seems 5x8 thus i cant fit the heart and simle to limited set.



any way to do this ?

Thanks in advance, Best regards.
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: Grumpy_Mike on Apr 15, 2019, 08:21 pm
Quote
Thus 9000 character limit of this post i cannot paste the code here as text
No but if you read the how to use this forum sticky post it will tell you how to attach it.

Depending on what else your invisible code is doing then a simple delay based on the pot value might help you achieve this. If not then you write your code as a state machine like the blink without delay example.

Quote
any way to do this ?
I am sure there is, however not being able to see your code is not helping home in on the fine details of your problem.
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: KsKBeko on Apr 15, 2019, 09:34 pm
here the code as attach
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: Grumpy_Mike on Apr 15, 2019, 10:39 pm
Thanks for that.
Is that the code that is working without any problem?

If so it is your unsuccessful attempt at change we need to see.
When you post it please say what it does and what you expect it to do.
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: KsKBeko on Apr 15, 2019, 11:05 pm
Is that the code that is working without any problem?

If so it is your unsuccessful attempt at change we need to see.
When you post it please say what it does and what you expect it to do.
Yes sir this is the final code which i run with POTs in this video https://youtu.be/wso0ny1WRPA (https://youtu.be/wso0ny1WRPA)
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: Grumpy_Mike on Apr 15, 2019, 11:29 pm
Quote
İs there a way to adjust instantly
Yes read the pot so that you set the speed with every update, not just at the start.
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: KsKBeko on Apr 16, 2019, 12:10 am
Yes read the pot so that you set the speed with every update, not just at the start.
could'tn you explain on my code ? which part should i change with what ? im not expert like you.  Explain it, just like explain to a stupid.
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: Grumpy_Mike on Apr 16, 2019, 05:33 am
Quote
Explain it, just like explain to a stupid.
This is the line that sets the scroll speed variable.
Code: [Select]
scrollSpeed = map(analogRead(A1), 0, 1023, 0, 500); // speed of scrolling text, lower is faster

This is the line that sets the speed by delaying for a specific amount of time:-
Code: [Select]
delay(shift_speed);

So everywhere you see this line you put the line:-
Code: [Select]
scrollSpeed = map(analogRead(A1), 0, 1023, 0, 500); // speed of scrolling text, lower is faster
before it.
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: GolamMostafa on Apr 16, 2019, 10:14 am
@OP

Check if there is any immediate affect in the scrolling speed by doing --

1  Comment out the following lines in the loop() function.
Code: [Select]
//scrollSpeed = map(analogRead(A1), 0, 1023, 0, 500);
//delay(100);
// clearLCD(maxInUse, scrollSpeed);


2.  Modifying the following line in the 'printCharWithShift()' function as indicated.
Code: [Select]
delay(map(analogRead(A1), 0, 1023, 0, 500));//shift_speed);
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: KsKBeko on Apr 16, 2019, 08:53 pm
@OP

Check if there is any immediate affect in the scrolling speed by doing --

1  Comment out the following lines in the loop() function.
Code: [Select]
//scrollSpeed = map(analogRead(A1), 0, 1023, 0, 500);
//delay(100);
// clearLCD(maxInUse, scrollSpeed);


2.  Modifying the following line in the 'printCharWithShift()' function as indicated.
Code: [Select]
delay(map(analogRead(A1), 0, 1023, 0, 500));//shift_speed);
Yessss sir you made my day thanks for the help that solved my problem.

sorry for late reply i just return from work

Best regards
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: KsKBeko on Apr 16, 2019, 09:03 pm
This is the line that sets the scroll speed variable.
Code: [Select]
scrollSpeed = map(analogRead(A1), 0, 1023, 0, 500); // speed of scrolling text, lower is faster

This is the line that sets the speed by delaying for a specific amount of time:-
Code: [Select]
delay(shift_speed);

So everywhere you see this line you put the line:-
Code: [Select]
scrollSpeed = map(analogRead(A1), 0, 1023, 0, 500); // speed of scrolling text, lower is faster
before it.
Thank for the idea sir
Title: Re: MAX7219 Adding Special patterns to scrolling text code and adjust speed via POT
Post by: KsKBeko on Apr 16, 2019, 09:18 pm
1-) Problem solved Thanks you dear mentors for this great help.

Now how to do Problem 2-) ?

Please teach me.

Thanks in advance, best regards