Kitchen Timer project using 16x LEDs and 2x 74HC595

Use this section to discuss your embedded Flowcode projects.
Post Reply
andeug
Posts: 52
http://meble-kuchenne.info.pl
Joined: Thu Jan 07, 2021 1:42 pm
Location: Stockholm (SE)
Has thanked: 16 times
Been thanked: 2 times

Flowcode v11 Kitchen Timer project using 16x LEDs and 2x 74HC595

Post by andeug »

Hi,


I am working to learn FC11 and am stuck on a project that involves a Click Ring from Mikroe with 32x LEDs (of which I am using only 16x LEDs), connected to an Arduino Nano 328 at 115200 baud. The schematic involves the following block components:
Digital timer with 16x LEDs and 2x 74HC595.pdf
(3.89 MiB) Downloaded 6 times
I had to do the mapping of the segments via ChatGPT, and I received the following, which I tested, and it works:
7seg_combinations.xlsx
(16.15 KiB) Downloaded 5 times
Now I am stuck with the Main macro, on which I need to work with variables, the pushbutton(s) PB1 (and eventually PB3), and time counting.

The way I thought the project was straightforward. They are the following times are pre-configured in Macros:

1 minute
2 minutes
3 minutes
4 minutes
5 minutes
6 minutes
7 minutes
8 minutes
9 minutes
10 minutes
15 minutes
20 minutes
25 minutes (Pomodoro cycle)
30 minutes
45 minutes
60 minutes

How should the timer work? I will explain below:

When I press PB1 once, the timer starts for 1 minute, and after 2 seconds, it begins blinking, indicating it will count 1 minute.
For the 1-minute configuration, I have used "solid" via "T_01min_indicator", and "blinking" state via "T_01min_blink".

When I press PB1 once, the timer starts for 2 minutes, and after 2 seconds, it begins blinking, indicating it will count 2 minutes.
For the 2-minute configuration, I have used "solid" via "T_02min_indicator", and "blinking" state via "T_02min_blink".
For the 2-minute indication, it needs to start with "T_02min_indicator", "T_02min_blink" and then "T_01min_blink".

... and so on. The problem with this approach is that if I am making a mistake in one "minutes" loop, the whole program will not work as expected. Shall I use a different approach instead? Below is what I have created:
Digital timer with 16x LEDs and 2x 74HC595.fcfx
(46.57 KiB) Downloaded 6 times
The kitchen timing in minutes is calculated by looping through the Macros associated with the counted time.

The challenges that I am experiencing are:

- The "Switch" option only has 10x possible states, while I have 16x.
- I do not know if I should use "Switch" or "Decision" while I am pressing the button and toggling through the minutes that I need to have counted.
- Shall I use only the "Buzzer" component, or "PWM", to generate sound on the buzzer with various intensities? (medium or high)
- Shall I use "Keyboard interrupt" for something, given the simplicity of the whole design?

Can someone please help me with this project?


Regards,
Andreas
FC11 Professional + ARD license
Matrix TSL E-blocks2 boards
Mikroe Click boards

andeug
Posts: 52
Joined: Thu Jan 07, 2021 1:42 pm
Location: Stockholm (SE)
Has thanked: 16 times
Been thanked: 2 times

Re: Kitchen Timer project using 16x LEDs and 2x 74HC595

Post by andeug »

The schematic of the LED Ring Click:
Led Ring R Click schematic.pdf
(346.48 KiB) Downloaded 5 times
The schematic of the 2x2 key Click:
2x2 Key Click schematic.pdf
(288.66 KiB) Downloaded 5 times
The picture of the whole assembly (I prefer off-the-shelf components to save time, instead of soldering):
IMG_0429.jpeg
IMG_0429.jpeg (175.62 KiB) Viewed 56 times
FC11 Professional + ARD license
Matrix TSL E-blocks2 boards
Mikroe Click boards

mnfisher
Valued Contributor
Posts: 1746
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 147 times
Been thanked: 815 times

Re: Kitchen Timer project using 16x LEDs and 2x 74HC595

Post by mnfisher »

I don't have access to any hardware (or indeed Flowcode) at the present. However, i would try and create a single macro Blink (count, pattern1, pattern2) rather than using individual macros for each time period.
Select the patterns using a lookup table (either the component or an array) with index as minutes.

Then it is a simple matter to step through the lookup table for each time

To clarify a bit. Button increases time...
.time = 0. // Device off

Increase .time on button press. (One press gives one minute).
.count = lut[1][0]
.pat1 = lut[1][1]
.pat2 = lut [1][2]

Blink(.count, .pat1, .pat2)

Where lut is defined as an array[16][3] for example if you have 16 possible time periods...

Martin

Post Reply