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
class Relay: | |
def __init__(self): | |
self.value = False | |
self._value = False | |
@property | |
def state(self): | |
"""Get the current relay state.""" | |
return self.value |
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
import rrdtool | |
import datetime | |
# retrieve RRD data (3 days past from now) | |
rrd = rrdtool.fetch('/home/pi/rrd/flow.rrd', 'AVERAGE', '-s -3d') | |
# timestamp start/end | |
start = rrd[0][0] | |
end = rrd[0][1] | |
step = rrd[0][2] |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import os | |
import pygame | |
import time | |
import signal | |
#some const | |
BLACK = (0, 0, 0) | |
RED = (200, 0, 0) | |
WHITE = (255,255,255) |
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
*.o | |
*.elf |
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
// set XTAL 32768 Hz on the board | |
void main(void) { | |
// Stop Watchdog | |
WDTCTL = WDTPW + WDTHOLD; | |
// MCLK:LFXT1CLK/8 | |
// SMCLK:LFXT1CLK | |
BCSCTL2 = 0xF8; | |
// IO setup | |
P1DIR = 0xFF; |
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
/* | |
An ATmega328P on a breadboard powered under 3.3v (2x AA battery) | |
Arduino bootloader at 8 MHz internal RC clock. | |
This example code is in the public domain. | |
Share it's happiness !!! | |
*/ | |
#include <SPI.h> |
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 python3 | |
import time | |
import schedule | |
import RPi_I2C_LCD | |
# global var | |
lcd = RPi_I2C_LCD.LCD() | |
def update_lcd(): |
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
import cv2 | |
import numpy as np | |
# open_cv track test : | |
# | |
# track blue object and check there are in circle area | |
# for test: object is a blue water bottle cap (color H,S,V = 202 (101 after normalized, 64, 59) | |
# some class |
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 python | |
# shoot jpg images at regular interval for timelapse (store to img/) | |
# | |
# build MPEG4 video with jpg files : | |
# ffmpeg -framerate 10 -i img/image%04d.jpg -c:v libx264 -r 10 video/timelapse.mp4 | |
#or | |
# ffmpeg -framerate 2 -i img/image%04d.jpg video/timelapse2.mp4 | |
import time |
OlderNewer