Code: Select all
def pwmDAC(val,freq,pin):
buf = bytearray(255)
dac = DAC(pin)
for i in range(len(buf)):
if i <= val:
buf[i] = 255
else:
buf[i] = 0
dac.write_timed(buf,freq * len(buf), mode=DAC.CIRCULAR)
Code: Select all
def pwmDAC(val,freq,pin):
buf = bytearray(255)
dac = DAC(pin)
for i in range(len(buf)):
if i <= val:
buf[i] = 255
else:
buf[i] = 0
dac.write_timed(buf,freq * len(buf), mode=DAC.CIRCULAR)
It is and I use them, but in this context it will not work as it is for an artist who makes sounds with the PWM signals, it is vital I can get audio from the R G and B plus I need to be able to set the pitch of the pwm. Each channel drives a short piece of LED strip. Also the WS2812 is not good over long lengths. Ideally I would make each led with a custom serial ( midi or DMX ) receiver but this is much simpler practically.kfricke wrote:Cool stuff but how about something like WS2812 RGB LEDs? Is far simpler imho!
There are a bunch of pins that need to be in a particular state when booting, since the chip supports bootloading over a number of interfaces.clack wrote: When I unplug the USB ( and it is connected to 5v on Vin ) though it is does not boot? , am I connecting to a pin that stops it booting up? or is there somthing I should be connecting or programming to make main.py run?
I can change the timer code so it allows you to control timer 3. If you don't need usb then it's not a problem changing the frequency of this timer. If you don't want to wait for a code change you can access the timer registers using the stm module.clack wrote: I can call the same frequency on all pins except the blue LED as it is fixed?
Do the pyboard leds light up in any way? Did you check voltage level on VIN and 3V3? Did you try pressing RST button? If it boots via usb then is should boot fine without usb.When I unplug the USB ( and it is connected to 5v on Vin ) though it is does not boot?