May-26-2018, 12:45 AM
(This post was last modified: May-26-2018, 12:46 AM by hhanswurster.)
Hardware is set up, pi is runnig :)
![[Image: img_20180524_200049-kopie-jpg.242]](https://timelapsenetwork.com/forum/attachments/img_20180524_200049-kopie-jpg.242/)
gphoto2 works :)
Now i need some help with variables, i cant not make it work :/
also for g_f i need floating point value so i tryed to use %f
any hints? :) Thanks!
gphoto2 works :)
Now i need some help with variables, i cant not make it work :/
# Camera setting script import smbus import time from subprocess import call # Get I2C bus bus = smbus.SMBus(1) # TSL2561 address, 0x39(57) # Select control register, 0x00(00) with command register, 0x80(128) # 0x03(03) Power ON mode bus.write_byte_data(0x39, 0x00 | 0x80, 0x03) # TSL2561 address, 0x39(57) # Select timing register, 0x01(01) with command register, 0x80(128) # 0x02(02) Nominal integration time = 402ms bus.write_byte_data(0x39, 0x01 | 0x80, 0x02) time.sleep(0.5) # Read data back from 0x0C(12) with command register, 0x80(128), 2 bytes # ch0 LSB, ch0 MSB data = bus.read_i2c_block_data(0x39, 0x0C | 0x80, 2) # Read data back from 0x0E(14) with command register, 0x80(128), 2 bytes # ch1 LSB, ch1 MSB data1 = bus.read_i2c_block_data(0x39, 0x0E | 0x80, 2) # Convert the data ch0 = data[1] * 256 + data[0] ch1 = data1[1] * 256 + data1[0] luxvis = (ch0 - ch1) # Output data to screen print "Sensor reading: %d lux" %(luxvis) # Decide what preset to use if luxvis <= 90: fiso= 1 g_iso = 100 g_f = 2.8 elif luxvis <= 120: fiso = 2 g_iso = 200 g_f = 10.0 elif luxvis<= 300: fiso = 3 g_iso = 100 g_f = 2.8 elif luxvis <= 4000: fiso = 4 g_iso = 1600 g_f = 8.0 else: fiso= 5 g_iso = 400 g_f = 4.0 # Output preset to screen print "Use iso and F setting number: %d" %(fiso) print "iso %d" %(g_iso) print "f %d" %(g_f) # Set iso and wait call(["gphoto2","--set-config","iso=%d"]) %(g_iso) print "setting iso and wait...." time.sleep(6) print "iso set!" # set F and wait call(["gphoto2","--set-config","F-Number=%d"]) %(g_f) print "setting f and wait...." time.sleep(6) print "f set!" # capture image, rename it and save it print "Capturing Image" call (["gphoto2","--capture-image-and-download","--filename","/media/pi/6CD8-2DB4/images/%Y_%m_%d_%H_%M_%S.arw"])i have a problem getting g_iso and g_f values into the call :/
g_iso = 100 call(["gphoto2","--set-config","iso=%d"]) %(g_iso)does not work.
call(["gphoto2","--set-config","iso=100"])does.
also for g_f i need floating point value so i tryed to use %f
any hints? :) Thanks!