Analog value with I2C display ssd1306

For general Flowcode discussion that does not belong in the other sections.
Post Reply
JulianL
Posts: 2
http://meble-kuchenne.info.pl
Joined: Wed Jul 24, 2024 12:01 pm

Analog value with I2C display ssd1306

Post by JulianL »

Hello,

I would like to ask for your help.
I am using Flowcode together with an Arduino and would like to read in an analog value and display it on an I2C SSd1306 display.
Problem: No permanent value is displayed.
You can find my program in the attachment.

Thank you for your help.
Attachments
Display.png
Display.png (620.78 KiB) Viewed 119 times
MyProgramm.png
MyProgramm.png (44.49 KiB) Viewed 119 times

mnfisher
Valued Contributor
Posts: 1684
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 145 times
Been thanked: 784 times

Re: Analog value with I2C display ssd1306

Post by mnfisher »

You are constantly updating the display in a loop - this means it will refresh very rapidly probably with slightly different values.
Try adding a delay.

Also - if the value's representation changes in length (say '10' then '9') - it will not clear trailing digits. One way round this is to convert the value to a string and append some spaces.

.str = ToString$(.value)
.str = .str + ' '
Display(.str) (PrintString from memory)

where .str is a (in this case local variable) declared as a string.

Martin

medelec35
Matrix Staff
Posts: 2121
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 658 times
Been thanked: 716 times

Re: Analog value with I2C display ssd1306

Post by medelec35 »

Hello.
In addition to Martin's reply, with he print function you need to have the Transparency Set to 0 and not 1.
This will make sure that that in the same location, the previous digit is overwritten.
What you are showing is all previous digits in the same location remaining.
That will prevent you from seeing what the current digit is.
Martin

JulianL
Posts: 2
Joined: Wed Jul 24, 2024 12:01 pm

Re: Analog value with I2C display ssd1306

Post by JulianL »

Hello,

Thanks for your help.

@Martin: Could you show me an example program for your idea using a flowchart? I don't quite understand how I can implement it.

Best regards, Julian

mnfisher
Valued Contributor
Posts: 1684
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 145 times
Been thanked: 784 times

Re: Analog value with I2C display ssd1306

Post by mnfisher »

Hi Julian,

Something like this - it runs AOK in simulation - in hardware you might need to check the pins used (C0 for ADC for example)

Adding a SetFontScaler(2,2) makes the display easier to read! (from the gLCD component)

Martin
Attachments
UnoADC_Demo.fcfx
(13.94 KiB) Downloaded 5 times

Post Reply