Created
November 22, 2016 09:53
-
-
Save oskar456/bf450e02dd47e2223414c733f01101b5 to your computer and use it in GitHub Desktop.
LED blink clock – flash LED every second
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh /etc/rc.common | |
# Copyright (C) 2016 OpenWrt.org | |
START=99 | |
USE_PROCD=1 | |
start_service() | |
{ | |
procd_open_instance | |
procd_set_param command "/root/blinkclock.py" | |
procd_close_instance | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
import time | |
import os | |
ledpath="/sys/class/leds/omnia-led:power/" | |
autonomous = os.path.join(ledpath, 'autonomous') | |
if os.path.exists(autonomous): | |
with open(autonomous, 'w') as aut: | |
aut.write('0') | |
with open(os.path.join(ledpath, 'trigger'), "w") as trg: | |
trg.write('oneshot') | |
while True: | |
now = time.time() | |
time.sleep(1 - now%1) | |
with open(os.path.join(ledpath, 'shot'), "wb") as shot: | |
shot.write('1') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment