Op 4 maart 2020 20:09:57 schreef Hunter:
...., want 8 leds onafhankelijk pwm-dimmen gaat op deze manier niet lukken. De controller heeft maar 3 pwm-kanalen.
Nu heb je het over HPWM denk?
Maar er is ook nog zoiets als dit.
Pwm Syntax Pwm Pin, Duty, Cycles Overview Output pulse-width-modulation on a pin, then return the pin to input state. Operators Pin is a Port.Pin constant that specifies the I/O pin to use. Duty is a variable, constant (0-255), or expression, which specifies the analogue level desired (0-5 volts). Cycles is a variable or constant (0-255) which specifies the number of cycles to output. Larger capacitors require multiple cycles to fully charge. Cycle time is dependant on Xtal frequency. If a 4MHz crystal is used, then cycle takes approx 5 ms. If a 20MHz crystal is used, then cycle takes approx 1 ms. Notes Pwm can be used to generate analogue voltages (0-5V) through a pin connected to a resistor and capacitor to ground; the resistor-capacitor junction is the analogue output (see circuit). Since the capacitor gradually discharges, Pwm should be executed periodically to refresh the analogue voltage. Pwm emits a burst of 1s and 0s whose ratio is proportional to the duty value you specify. If duty is 0, then the pin is continuously low (0); if duty is 255, then the pin is continuously high. For values in between, the proportion is duty/255. For example, if duty is 100, the ratio of 1s to 0s is 100/255 = 0.392, approximately 39 percent. When such a burst is used to charge a capacitor arranged, the voltage across the capacitor is equal to:- (duty / 255) * 5. So if duty is 100, the capacitor voltage is (100 / 255) * 5 = 1.96 volts.