This next code fragment is found in the main while loop.
At lines (4) and (5), we are reading in the voltage values from the frequency and duty cycle Pots, before using the map_value() function to convert the voltage range of 0-3.3 volts into our desired frequency and duty cycle ranges we saw defined as global variables. Notice that we are also formatting the duty cycles as a percentage value for display purposes:
frequency = int(map_value(frequency_ch.voltage, # (4)
MIN_A_IN_VOLTS, MAX_A_IN_VOLTS,
MIN_FREQ, MAX_FREQ))
duty_cycle = int(map_value(duty_cycle_ch.voltage, # (5)
MIN_A_IN_VOLTS, MAX_A_IN_VOLTS,
MIN_DUTY_CYCLE, MAX_DUTY_CYCLE))
duty_cycle_percent = int((duty_cycle/MAX_DUTY_CYCLE) * 100)
pi.hardware_PWM(LED_GPIO_PIN, frequency, duty_cycle) # (6)
At line (6), we use pi.hardware_PWM() to use the Raspberry Pi's...