TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: R.WIESER
from: DRUCK
date: 2019-11-30 16:38:00
subject: Re: One I2C bus, two prog

On 23/11/2019 08:55, R.Wieser wrote:
> Hello all,
>
> I've got a few I2C modules (clock, temperature sensor, etc) that I would
> like to access using different programs.
>
> The question is: how do I allow multiple programs to access the same I2C
> bus, but not interfering with each other ?

Normally for a device which requires reading and writng you would create
a driver providing an API to clients, which would serialise access to
the device.

However if it is only reading the value of sensors, it is probably
easiest to have one program which regular reads the values, and
publishes them for other programs to use.

For example, to get a running average of the CPU temperature over a
period of 15 minutes, I wrote a python program which runs as a daemon at
start up, reading the CPU temperature every second calculating the
running average, min and max values. The values are read by running
another instance of the program which communicates with the daemon
instance via a named pipe.

---druck

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.