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
/* | |
Adafruit Arduino - Lesson 4. 8 LEDs and a Shift Register - Brightness | |
*/ | |
int latchPin = 5; | |
int clockPin = 6; | |
int dataPin = 4; | |
int outputEnablePin = 3; | |
byte leds = 0; |
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/python | |
import collections | |
from datetime import datetime | |
import json | |
import sys | |
try: | |
from pySMART import Device | |
except ImportError: |
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
$ sudo -i | |
$ crontab -e | |
# add the following using your editor | |
* * * * * python /PATH/TO/SCRIPT/bin/read_disk_temps.py |
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
""" Takes output from "sensors" command and writes it to | |
a file by default. Can also connect to Redis and Influxdb | |
""" | |
#!/usr/bin/python | |
import subprocess | |
import json | |
from datetime import datetime | |
from traceback import print_exc |
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/python | |
import collections | |
from datetime import datetime | |
import json | |
# https://pypi.python.org/pypi/PySensors/ | |
# tl;dr: "sudo pip install pysensors" | |
import sensors | |
# you can install these modules with pip if needed | |
try: |
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
$ sudo smartctl --all /dev/sda -s on | |
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.16.0-60-generic] (local build) | |
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org | |
=== START OF INFORMATION SECTION === | |
Model Family: Western Digital AV SATA | |
Device Model: WDC WD2500AVJS-63B6A0 | |
Serial Number: WD-WCAT10290663 | |
LU WWN Device Id: 5 0014ee 1563ee704 | |
Firmware Version: 01.03A01 |
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
sudo apt-get install smartmontools |
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
$ python | |
Python 2.7.6 (default, Jun 22 2015, 17:58:13) | |
[GCC 4.8.2] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import sensors | |
>>> sensors.init() | |
>>> try: | |
... for chip in sensors.iter_detected_chips(): | |
... print '%s at %s' % (chip, chip.adapter_name) | |
... for feature in chip: |
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
#include <DHT.h> | |
#include <Wire.h> | |
#include <Adafruit_Sensor.h> | |
#include <Adafruit_BMP085.h> | |
#define DHTPIN 2 | |
#define DHTTYPE DHT22 | |
DHT dht(DHTPIN, DHTTYPE); | |
int LDR_Pin = A0; |
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
#include <Wire.h> | |
#include <string.h> | |
#include <Adafruit_MotorShield.h> | |
#include "utility/Adafruit_PWMServoDriver.h" | |
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); | |
Adafruit_DCMotor *motor3 = AFMS.getMotor(3); | |
Adafruit_DCMotor *motor4 = AFMS.getMotor(4); |