I'm trying to make a shutter speed variable based on a reading from an adafruit TSL2561 lux sensor. Lux is converted to an Exposure value using the equation in my code below, and then an shutter speed corresponds with the calculated EV (if aperture and ISO are constant).
I've tried assigning a shutter speed variable using an if command and a list, but I keep getting an error, saying:
"NameError: name 'shutterspeed' is not defined.
I'm very new to Python and I'm sure there is a better way of doing this, I just don't know where to start.
ev1 = (math.log(ch2/2.5)/math.log(2))) + 3 ss = [32000, 16000, 8000, 4000, 2000, 1000, 500, 250] if ev1 == 8: shutterspeed = ss if ev1 == 9: shutterspeed = ss if ev1 == 10: shutterspeed = ss if ev1 == 11: shutterspeed = ss if ev1 == 12: shutterspeed = ss if ev1 == 13: shutterspeed = ss if ev1 == 14: shutterspeed = ss if ev1 == 15: shutterspeed = ss