Python Forum
Preventing useless multiple disk writes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Preventing useless multiple disk writes
#7
Quote:I think that when you initialize the gpio as input it resets and either becomes low or floating so it does not retain it last status.

I think you're right.
Lets try without setting it as input:

GPIO.setup(gpio, GPIO.OUT)
GPIO.output(gpio, GPIO.HIGH)
print(GPIO.input(gpio))
GPIO.output(gpio, GPIO.LOW)
print(GPIO.input(gpio))
Quote:I got a bit further by defining the prevpumpstat variable in datalog.py and including it in the call to pumpcontrol.

This is a more concise way to do it (IMHO). I thought that you couldn't modify the previous code.
Reply


Messages In This Thread
RE: Preventing useless multiple disk writes - by gontajones - Jul-26-2018, 09:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Mirroring disk structures in nested dictionaries Curbie 16 3,286 Apr-27-2025, 02:43 PM
Last Post: deanhystad
  DEC pack, unpack and disk-images Curbie 32 8,085 Aug-23-2024, 03:37 PM
Last Post: Curbie
  Windows Disk Cleanup Code Help Needed nal2us2 3 1,213 Jul-19-2024, 04:03 AM
Last Post: deanhystad
  Python logging RotatingFileHandler writes to random file after the first log rotation rawatg 0 1,642 Feb-15-2024, 11:15 AM
Last Post: rawatg
  Hard disk structure like a file selection dialog malonn 2 1,940 Aug-09-2023, 09:14 PM
Last Post: malonn
  Preventing Duplicate Placement in 2D Array nickdavis2017 2 2,970 Feb-03-2022, 11:06 PM
Last Post: nickdavis2017
  writelines only writes one line to file gr3yali3n 2 4,807 Dec-05-2021, 10:02 PM
Last Post: gr3yali3n
  How to Calculate CPU, Disk, Memory and Network utilization rate skvivekanand 1 2,745 Jun-16-2020, 08:53 PM
Last Post: jefsummers
  how to write offset number to disk use python? Pyguys 4 4,460 Apr-11-2020, 07:53 AM
Last Post: Pyguys
  Useless Newbee craigpusey 2 98,339 Mar-04-2020, 02:13 PM
Last Post: craigpusey

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020