Max7219

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Max7219

Post by jgu1 »

Hi Team!

I will ask before I do something wrong. Is it possible (will it work) to copy Martin´s nice FC7
"Max7219MatrixJGU.fcpx" component from here:

http://www.flowcode.co.uk/mmforums/viewt ... 219#p85940 into FC8 component lib.

Thank´s in advance.

Jorgen.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: Max7219

Post by kersing »

Jorgen,

It is always better to define your own component folder. See Custom Location. That way you are sure your components will not be lost on update or overwritten by a Matrix component at some future date.

Will that component work? Hard to say. The file is compatible. If the logic works depends on what (if any) (CAL) components are used by Martin. It won't do any harm to try and test ;-)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi Kersing!

Thank’s. I will give it a go, and try.

Br Jorgen

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

Hi Jorgen,

I hope it works under FC8, but haven't actually tried it yet... I don't think there is anything which should cause any problems and can recompile it if needed.
I can't remember if I ever posted the final source code to the forum, but can post it if it would help....

Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi all!

Martin I am not home at the moment, back in the weekend and then I try again. Hopefully it work. But I make a try here on my laptop. I have tryed to follow kersing´s path, but I can´t manage to get it work.
I also copy it directly in the compnent Dir. Can´t find it anywhere in FC.

You created this (last file) to me Max7219MatrixJGU.fcpx and it work.


Maybe Ben or some of the other MM guy could add to the file to the list when we update files in the helpmenu.

Br Jorgen

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

jgu1 wrote:Hi all!

Martin I am not home at the moment, back in the weekend and then I try again. Hopefully it work. But I make a try here on my laptop. I have tryed to follow kersing´s path, but I can´t manage to get it work.
I also copy it directly in the compnent Dir. Can´t find it anywhere in FC.

You created this (last file) to me Max7219MatrixJGU.fcpx and it work.


Maybe Ben or some of the other MM guy could add to the file to the list when we update files in the helpmenu.

Br Jorgen

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

Go to
View
.. Global Options
Choose Locations tab

Then click ... by the Look for components in... box and browse to the directory the library file is in..

You'll probably need to restart Flowcode (no just tried and you don't)...

Search for MAX7219... It comes up under Misc components.

I haven't tested it on hardware - but it certainly compile and links AOK.

Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi Martin!

Yes, Now I can see the componet in "Misc". Test it on hardware during the weekend. Thank´s a lot.


Br Jorgen

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi Martin!

Everything work in FC8. I can see the component and I am able to program the Arduino. Perfect. :D

The last component you create for me, was: Max7219MatrixJGU.fcpx and it work. Don´t know if you have make some more feature´s :wink:

Thank´s.


Br Jorgen.

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

Glad it still works!

Any suggestions for new features welcome - I can try and implement them, time permitting... I get a lot less time to work on projects in the summer..

Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi Martin!

Thank you. Yes I have some wishes, commimg later today.

Thank `s

Br Jorgen

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi Martin!

Do you think it is possible to make a thermometer similar like these with your Max7219 component in FC :

https://www.youtube.com/watch?v=WzBnRfKqRqg or

https://www.youtube.com/watch?v=cS9EJ-z7vFE or funny

https://www.youtube.com/watch?v=vlSWTODM6Y8

I could imagine that, when I get the tepmerature from the sensor, DS1820 or sht21, DHT22 whatever I use I have to convert the value to string and then use the string to show or scroll in the display.

Br Jorgen

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

Hi Jorgen,

Yes - Just get the temp or humidity as a string and append to the message - then scroll across or Scroll 'temperature' and then flash the temperature to the middle of the display or..... Nothing new needed here.....

The clock (3rd video) has some fancy slide-ins and slide-outs (if that's the correct terminology) - but hey, what a lot of jumper wires :D
I rather like some of the different draw routines - I'll have a go at a couple....

Martin

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

First effects:

Came up with my first set of effects:

By implementing a routine that plots a single pixel row of a line of text to an arbitrary pixel location - first effect slides text into view a line at a time... Also allows a 'clear' as the reverse of this.

I think this should allow various displays to be implemented easily (for instance draw in 0,2,4,6 then 1,3,5,7)

Works AOK on inline MAX7219 displays - It will need a tweak to work on the 'rotated' displays that you are using..

Other suggestions welcome! (eg I wondered about a 'random' fade - display fully on and then 'random' pixels erase to leave text?)

Martin

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

Ok -

Here is a quick demo of the 'slew' display.

I've re-exported as a component (should now appear in Displays) - and I've added a few macros:

Demo(n) - display a demo (1..10) 10 is a slew. Display needs to be initialized first. (I'd get rid of this in a release as it swallows a fair bit of memory)
DispTextLine(string, x, y, r) where r is the row of the character.
Slew(string, d, pause, invert) - Display a string (actually just the first n characters where n is the length of the display) - d is distance between rows and pause is a delay between scrolls. Depending on invert it either starts on the first or final row of the character. If d is the number of chars in display * 8 then one line at a time scrolls in....
Note that this is a bit quicker for 'inline' displays - so for rotated ones a delay of 1(ms) instead of the 2ms in the demo would probably be sufficient.

QPlotR(x, y, set) - a quick plot that uses display rotation) - you'll need to refresh the display after (single or many) use(s)...

I've added a new property - Rotated - set to 1 if your displays are rotated about 90 degrees (Jorgen - set to 1) - I feel this could be 0..3 for 0, 90, 180 and 270 degrees and get rid of swapX, swapY - maybe when I have a little more time (just getting ready to set off on holiday here :-) )

Spent rather more time than I care to admit - tracing a bug that turned out to be a loose connection!
Max7219MatrixJGU.fcpx
(7.95 KiB) Downloaded 282 times
Suitable test flowchart...

Martin
main.JPG
main.JPG (15.24 KiB) Viewed 12795 times

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi Martin!

Very interesting :D I Will test it this weekend. Thank`s

Br Jorgen.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi Martin!

Finally, I get time to test your new component.

First I renamed the new component to: Max7219MatrixJGUSlew.fcpx and added it in the other Lib where I have the Max7219MatrixJGU.fcpx

But I can´t find it in the search function. Then I made a new Lib, Exportkomponenter2 and place the new component there, but can´t still find the new component only the "old one".

Again, what am I doing wrong?

Br Jorgen
Attachments
Udklip1.PNG
(18.81 KiB) Downloaded 4789 times
Udklip.PNG
(8.5 KiB) Downloaded 4789 times

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

Hi Jorgen,

Try importing the max 7219 Lib that appears,. If there is a slew function then it is the right one, if not then try renaming the old file (.bak) and try again... I'm not sure I renamed it and I'm away at the moment so cant check.

Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi Martin!

Thank’s againg.

Late reply:

1. I am very busy at the moment.

2. I have start to make a thermometer and humidity with DHT22 and with the old of your max7219 component not the slew.
So still use the old. Semeed to work.

3. I look forward to test the new ‘slew’ component. :D

Thank`s in advance Martin and you hear and when thermometer work. Fancy. I share.

Br. Jorgen.

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

Another simple effect.

I've called it FadeIn - but in the scheme of things it isn't a very good name. It sort of draws a string over the current display in a number of loops.

Arguments are :
string to draw (if length(string) < length of display it will clear extra characters so it can also be used as a clear function)
step - number of loops to draw the string over (so 2 will draw the character in two steps (alternate pixels), 3 in 3 steps (every third pixel))
delay - pause (in ms) between 'layers' - the smaller step is the larger this should be.

Demo displays an example if you use Demo(0)
Max7219MatrixJGU.fcpx
(8.31 KiB) Downloaded 277 times
Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi Martin!

Now I managed to get DHT22 work with your Max7219MatrixJGU.fcpx (THE FIRST ONE). It working :D :D :D

Have a look here Note the display are not complete strait, so flickering a little: https://www.youtube.com/watch?v=VJiWXlhecDk :D :D

I have not tested your new component yet, but I will try to work with your new macro´s. Maybe you can edit my program with your fancy thing´s :wink:

Br Jorgen
Attachments
TestJGUMedDHT2.fcfx
(14.94 KiB) Downloaded 216 times

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

Thanks, on YouTube and in lights too!

I uploaded a video showing the same with Slew and Fade of the temperature and humidity (without clearing the display first - although that works too) - in truth I cheated, there is no DHT sensor connected and the temperature and humidity are just strings (needed to enlarge the humidity string to include the %) - probably fair as it's just the movies (and as you can tell from the custom set and hand-held camera work I don't upload many (or until now any) videos) You could add an 'effect' counter and vary the effect each time?

See https://youtu.be/2RHFy42B_x8

Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: Max7219

Post by jgu1 »

Hi Martin!

Waow, really fancy, i like this. :D :lol:

Two thing`s If ok, would you share this program, please?

Is it possible, already in start of the program, before loop, to initialyse the direction, you know 0,1,2,3 the 0, 45, 90 ect. Of the digital.

Thank’s

Br Jorgen

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

Hi Jorgen,

I can - though it is really just your program. I just replaced the ScrollStr3 to display the temperature and humidity with Slew and FadeIn.
test.png
(9.63 KiB) Downloaded 4661 times
Which adds a '%' to the humidity string (note that I had increased the size of Humidity to allow this) then fades it in over 7 loops with a delay of 50ms between each loop. Note that I think larger number of steps with a smaller delay probably looks better - and using a step of 0 doesn't draw anything..

Martin

mnf
Valued Contributor
Valued Contributor
Posts: 1208
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times

Re: Max7219

Post by mnf »

Direction is stored as Direction (for SwapX), SwapY for SwapY (- when I started I just had left-right, and I added SwapY when I discovered I needed this. I'm not sure why I didn't change the name for direction ?) and Rotated as itself. Can these be accessed from a program - yes and no. Using the component name :: the property (eg MAX7219::Rotated) gives access to the property but I can't just do .x = MAX7219::Rotated without getting an 'incompatible types' error.

I could add a 'GetRotation' macro that returns an int (& possibly SetRotation) - if this would be useful.

(Note that I've given the 0,90,180, 270 rotation some thought - and I think it would still need a 'reflected' property to reflect in the x axis - so at present have left well alone.)

Martin

Post Reply