I have a Seeed Studio XIAO SAMD21(Seeeduino XIAO) - Arduino Microcontroller. I want to have three pins put out a frequency using PWM. I am trying to use the below code. If I comment out one of DOut2, Dout3, or Dout4; the code runs and the two pins output the correct signal. However, when I have all three DOuts, I get the following error: RuntimeError: All timers in use
. Any advice is appreciated.
#Seeeduino XIAO Program (to run on microcontroller)
import supervisor
import time
import board
import digitalio
import pwmio
import analogio
if __name__ == "__main__":
frequency = 25
DOut2 = pwmio.PWMOut(board.D2, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
DOut3 = pwmio.PWMOut(board.D3, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
DOut4 = pwmio.PWMOut(board.D4, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
DOut2 = pwmio.PWMOut(board.D2, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
#DOut3 = pwmio.PWMOut(board.D3, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
DOut4 = pwmio.PWMOut(board.D4, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
Works
DOut2 = pwmio.PWMOut(board.D2, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
DOut3 = pwmio.PWMOut(board.D3, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
#DOut4 = pwmio.PWMOut(board.D4, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
Works
#DOut2 = pwmio.PWMOut(board.D2, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
DOut3 = pwmio.PWMOut(board.D3, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
DOut4 = pwmio.PWMOut(board.D4, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
Works
DOut2 = pwmio.PWMOut(board.D2, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
DOut3 = pwmio.PWMOut(board.D3, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
DOut4 = pwmio.PWMOut(board.D4, duty_cycle = 32767, frequency = int(frequency), variable_frequency = True)
Gives 'RuntimeError: All timers in use'