Read out an A/D (LTC2400) on I2C
-
I want to read out an LTC2400 on I2C-bus.
the command in linux : i2cget - y 2 0x28 (bus =2, device = 0x28)
this works.Because my qt.-programm is in C++, I tried with command:
system("i2cget - y 2 0x28")
this works not.
Please can you help me.@inexpert
If you show your command asi2cget - y 2 0x28 (bus =2, device = 0x28)
why do you only enteri2cget - y 2 0x28
, that's not the same?this works not.
Define "works not"? Did you check exit code? Did you check whatever was written to stdout/stderr?
So long as you use
system()
this question has nothing to do with Qt.Use Qt's
QProcess
tostart()
,waitForFinished()
andreadAll()
if you want to use Qt calls and fetch any output. -
@inexpert
If you show your command asi2cget - y 2 0x28 (bus =2, device = 0x28)
why do you only enteri2cget - y 2 0x28
, that's not the same?this works not.
Define "works not"? Did you check exit code? Did you check whatever was written to stdout/stderr?
So long as you use
system()
this question has nothing to do with Qt.Use Qt's
QProcess
tostart()
,waitForFinished()
andreadAll()
if you want to use Qt calls and fetch any output. -
Thank you for your reply.
The command in Linux is
i2cget - y 2 0x28
In bracket (bus = 2, device = 0x28) is only to explain what 2 and 0x28 mean.
„works not“ mean that the exit code is always 0x01 instead of the correct
value 0x20.
I thougt that I have in C++ , the Linux [link text]()command to give as parameter in the function system(). -
Thank you for your reply.
The command in Linux is
i2cget - y 2 0x28
In bracket (bus = 2, device = 0x28) is only to explain what 2 and 0x28 mean.
„works not“ mean that the exit code is always 0x01 instead of the correct
value 0x20.
I thougt that I have in C++ , the Linux [link text]()command to give as parameter in the function system().@inexpert said in Read out an A/D (LTC2400) on I2C:
mean that the exit code is always 0x01 instead of the correct
value 0x20.As suggested then: instead of
system()
useQProcess
and its methods to show you any output (including error message) is likely being produced.