Piergiorgio Sartor <piergiorgio.sartor.this.should.not.be.u...@nexgo.removethis.de> wrote: > On 06/07/2024 09.28, Chris Green wrote: > > I have a Raspberry Pi in my boat that uses I2C to read a number of > > voltages and currents (using ADS1115 A2D) so I can monitor the battery > > condition etc. > > > > At present various different scripts (i.e. processes) just read the > > values using the I2C bus whenever they need to but I'm pretty sure > > this (quite rarely) results in false readings because two processes > > try to read at the same time. > > > > Thus I'm looking for ways to prevent simultaneous access. > > Why using "different scripts"? > Is it there any particular reason? > > Maybe it would be better, if possible, to have > a single script, which, sequentially, reads > whatever needs to be read (or written). > In a loop. > > This is even simpler than using a file. > Yes, but it's conceptually (and programming wise) much simpler to have separate scripts. Some of them are simple 'on demand' scripts that I run from the command line when I want to know something. Others are scripts that drive displays on control panels.
-- Chris Green ยท -- https://mail.python.org/mailman/listinfo/python-list