x+y+z=100

I need help with software. There are 6 buttons 3 LEDs 3 3x7 segment displays. The buttons are x, y and z, x1, y1, z1. X button up, x1 button down, y button up, y1 button down, z button up, z1 down button. The x, y, z buttons have 3x7 segment displays. Here I want to see the LEDs connected to the output, the sensitive PWM connected to the buttons, and the pwm values in the 3x7 segment displays. The operating logic of the circuit, for example, every time I press or hold down the X button, the PWM signals will be seen as one step and the rising values will be seen as numbers in the 3x7 segment x indicator. X output LED will also appear to be running in percent pwm. For example when I hold down the X button or press it individually, write 70 in 3x7 X segment. This value indicates that pwm is 70%. X led is 70% working. Add the 30% value to the Y and Z buttons. It can not be up to 70% of X value. X value can take a value number down. I need the X1 button for it. Press X1 button 20 times; X value is reduced by 20%. X value, 3x7, X marks the number 50 in the notation. Y and Z values do not change. Y and Z are the same. Y = 15, Z = 15 numbers are the same in 3x7 Y and Z segments. To increase Y and Z values; Y and Z buttons are used. The highest total value of Y and Z is 50%. Logic is short.

This post made my head spin.
Maybe wise to start with the 7-segment display and two buttons. One for up, and one for down.
Plenty of 7-segment sketches if you Google that, as already explained in you other post.
Leo..

In this task, there are 2 sharps buttons of x, y and z 3x7 segments. There are 6 buttons in total.

Logic is short.

So is life.

Break it down into (much) smaller tasks. I don't understand what you want the project to do but it looks like you need to...

Read a switch input. Detect when a switch changes state. There are tutorials for switch inputs. Make a sketch that sends a message to a serial window every time a switch changes state.

Drive an LED with a PWM. There are LOTS of tutorials.

Use timers and do things at fixed intervals. Make a sketch that blinks an LED every second. Do it without using Delay().

Measure how long a switch is held down. Look at timer tutorials. Use millis(). Make a sketch that every time a switch is released it sends a message to a serial window that indicates how long the switch was held down.

Drive a 7 segment. Look for 7 segment tutorials. Make a sketch that displays number on the 7 segment display. Then make it count every second.

Once you have that, then you have all the building blocks for what you want to do. The logic of incrementing or decrementing different counters is just basic math.

Hi,
I think the Op has;

  • Three Channels connected to 3 PWM outputs, Channel X, Channel Y and Channel Z.
  • On the front panel each channel has a 3 digit readout and two buttons
  • The readout indicates PWM %
  • The buttons are %up or %down for that relevant readout and PWM output.
  • The sum of PWM_X% + PWM_Y% + PWM_Z% = 100.

I'm not sure how of the priotrity of channel change that has to take place when say CH_X increases and the sum > 100, which other channel has to decrease its %PWM.

I think thats what the OP is trying to say.

Tom... :slight_smile:

Taking Tom's summary as a basis, I guess the OP has only got to add what the state is when the system first starts. X=100. Y=0. Z=0. Or what? As I understand it, any 'slack' left after reducing a value on one display can be taken up by any channel up to a total of 100. No priority is otherwise suggested.

Just a few comments on the circuit fro the link in the OP

  • 2 of the chosen pins for the leds are not pwm pins
  • Only 2 daisychained max7219 chips are needed
  • Using internal pull-up resistors would reduce the component count.

Resim Yükle - Hızlı Resim - Resim Paylaş - Resmim.Net from OP

This is my best attempt at trying to lay out the Original Post in a comprehensible way.

I need help with software.

There are 6 buttons 3 LEDs 3 3x7 segment displays.

The buttons are x, y and z, x1, y1, z1.
X button up,
x1 button down,
y button up,
y1 button down,
z button up,
z1 down button.

The x, y, z buttons have 3x7 segment displays.

Here I want to see the LEDs connected to the output,
the sensitive PWM connected to the buttons,
and the pwm values in the 3x7 segment displays.

The operating logic of the circuit, for example,
every time I press or hold down the X button,
the PWM signals will be seen as one step
and the rising values will be seen as numbers in the 3x7 segment x indicator.

X output LED will also appear to be running in percent pwm.

For example when I hold down the X button or press it individually, write 70 in 3x7 X segment.
This value indicates that pwm is 70%.
X led is 70% working.

Add the 30% value to the Y and Z buttons.

It can not be up to 70% of X value.

X value can take a value number down. I need the X1 button for it.
Press X1 button 20 times;
X value is reduced by 20%.
X value, 3x7,
X marks the number 50 in the notation.

Y and Z values do not change. Y and Z are the same.
Y = 15, Z = 15 numbers are the same in 3x7 Y and Z segments.
To increase Y and Z values; Y and Z buttons are used. The highest total value of Y and Z is 50%. Logic is short.

Without meaning to be unkind some of it makes no sense at all. For example
"The x, y, z buttons have 3x7 segment displays."
and
"the sensitive PWM connected to the buttons "
and
"the PWM signals will be seen as one step"

@apollo66 you have not posted your program and if your use of X and X1, Y and Y1 etc in the description reflects the fact that those are the variable names in the code it is not hard to imagine why you are confused. Use meaningful names for your variables and many logic problems become perfectly clear.

If you want more help post your program (with meaningful variable names) and provide an understandable description of the requirement and the actual behaviour of the program.

...R

What I am curious about is to what use this development will be applied. When such complex applications emerge here and where it is difficult to imagine to what end purpose, these turn out to have some purely 'academic' value.

x+y+z=100

Maybe OP wants to limit total current e.g. to an RGB LED strip.
Still able to reach full brightness of one channel, but making sure if a second or third channel is added that total current is not more than the equivalent of one channel.
That does not work, unless PWM signals don't overlap.
Leo..

When such complex applications emerge here and where it is difficult to imagine to what end purpose, these turn out to have some purely 'academic' value.

In other words it is his assignment he wants us to do for him.