コード例 #1
0
ファイル: wakeup1.py プロジェクト: re3e-yul/Sentry
# Rely on RTC to keep the time
subprocess.call(["sudo", "hwclock", "--hctosys"])

# Record start time
txt = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' -- Started\n'
with open('/home/pi/test.log', 'a') as f:
    f.write(txt)

# This script is started at reboot by cron.
# Since the start is very early in the boot sequence we wait for the i2c-1 device
while not os.path.exists('/dev/i2c-1'):
    time.sleep(0.1)

try:
    pj = pijuice.PiJuice(1, 0x14)
except:
    print("Cannot create pijuice object")
    sys.exit()

# Do the work
for i in range(60):
    print('*', end='')
    sys.stdout.flush()
    time.sleep(1)
print()

# Set RTC alarm 5 minutes from now
# RTC is kept in UTC
a = {}
a['year'] = 'EVERY_YEAR'
コード例 #2
0
ファイル: box.py プロジェクト: OlivierGaillard/aquabox
 def initPijuice(self):
     self.logger.debug('initPijuice...')
     import pijuice
     self.pj = pijuice.PiJuice(1, 0x14)
     self.logger.debug('Done.')