From: WSU_HARBOR <luz...@ho...> - 2009-04-19 04:33:25
|
Using a Verdex Pro Gumstix: Essentially, I want to run this command in Python to control a PCF8574 (I2C): os.system('i2c 0x38 wb 0x38 0xff') #this command works However, I need to input a range of hex numbers (0x01 to 0xff) from a Python variable. Does anyone know how I can change the 0xff to a Python variable that I can control? I think it runs along the lines of: hex = 0xff os.system('i2c 0x38 wb 0x38 "hex"') I think I have the logic down, but I don't know how the Python code works when dealing with embedded Linux commands. Is there even a way to mix Python with Linux commands like that? Or, is there a better way to access the I2C bus without using embedded linux commands? Thank you -- View this message in context: http://www.nabble.com/How-do-I-embed-a-Python-variable-into-a-Linux-command-in-Python--tp23119199p23119199.html Sent from the Gumstix mailing list archive at Nabble.com. |