This file contains hidden or 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
// from https://github.com/pololu/drv8835-motor-shield | |
#include <DRV8835MotorShield.h> | |
// from https://github.com/z3t0/Arduino-IRremote/ | |
#include <IRremote.h> | |
// some consts | |
#define RECV_PIN 5 | |
#define PWR_IR_VCC 4 | |
#define PWR_IR_GND 3 | |
#define LED_PIN 13 |
This file contains hidden or 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 paho.mqtt.client as mqtt | |
# import ssl | |
import time | |
# some const | |
# mqtt account | |
MQTT_HOST = 'io.adafruit.com' | |
MQTT_USER = '<USERNAME>' |
This file contains hidden or 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 | |
from Crypto.Cipher import AES | |
import hashlib | |
import os | |
# message to crypt with AES-128 | |
text = 'the secret message' | |
# define 128-bit key from a text password |
This file contains hidden or 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
/* | |
MKRFox1200 Test: send s counter every 15 min | |
Power with 2 AA battery: under 3.18v, avg current is 1.7 ma | |
*/ | |
#include <ArduinoLowPower.h> | |
#include <SigFox.h> | |
// some vars |
This file contains hidden or 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 | |
# make high pulse on relay attach to Rpi GPIO | |
# see REL_PIN_MAP to fix GPIO pin number | |
import time | |
import argparse | |
import RPi.GPIO as GPIO | |
# some const |
This file contains hidden or 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/bash | |
# Update thingspeak from command line | |
# Usage : thingspeak WRITE_API_KEY DATA | |
# Example : thingspeak XXXXXXXXXXXX field1=11&field2=12 | |
# consts | |
URL="https://api.thingspeak.com/update" | |
# vars |
This file contains hidden or 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/bash | |
# read DS18B20 (default is data connect on GPIO4) | |
# add 'dtoverlay=w1-gpio' to /boot/config.txt to load one-wire device tree and reboot | |
# test on Rpi with Raspbian Jessie | |
while [ true ] | |
do | |
cat /sys/bus/w1/devices/28-0000040de8f8/w1_slave | grep 't=' | awk -F 't=' '{printf("%.2f\n", $2/1000)}' | |
done |
This file contains hidden or 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 http.client | |
from sense_hat import SenseHat | |
import dateutil.parser | |
import datetime | |
import schedule | |
import time | |
import threading | |
import json |
This file contains hidden or 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 | |
# Spirit bubble with Rpi Sense Hat: use 8x8 LEDs and accelerometer | |
from sense_hat import SenseHat | |
import schedule | |
import time | |
# some const | |
RED = (255, 0, 0) | |
GREEN = (0, 255, 0) |
This file contains hidden or 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
/* | |
Arduino modbus RTU frame sender (for test purpose) | |
*/ | |
// some modbus frames | |
const uint8_t f1[] = {0x0a, 0x03, 0x00, 0x00, 0x00, 0x01}; | |
const uint8_t f2[] = {0x0b, 0x03, 0x00, 0x00, 0x00, 0x10}; | |
// some functions | |
uint16_t crc16(const uint8_t *buf, uint8_t len) |