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
count1 = 0 | |
count2 = 0 | |
count3 = 0 | |
while count3 < 100: | |
count1 = count1 + 1 | |
count2 = count2 + 1 | |
count3 = count3 + 1 | |
if count1 == 3 and count2 == 5: | |
print 'fizzbuzz' |
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 | |
# Script to read gps data and log it to a file | |
# Must connect a gpsd socket on UART before running this script, using: | |
# sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock & | |
import os | |
from gps import * | |
from time import * | |
import time | |
import csv |
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 | |
# weatherLogger.py | |
# Updated 2015-06-16, by D. Fisher | |
# Weather station program for RPi | |
# Sensors: BMP180 air pressure, DHT humidity/temperature, TSL2561 luminosity | |
# Sends to wunderground.com for weather station KMNMINNE86, also records | |
# each measurement to a datafile | |
import urllib | |
import urllib2 |
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
// THIS IS A CODE SNIPPET ONLY AND WILL NOT RUN AT ALL ON ITS OWN!! | |
// Variables declared globally for interrupt use | |
// Start of channel interval | |
volatile uint16_t ch1_start = 0; | |
volatile uint16_t ch2_start = 0; | |
volatile uint16_t ch3_start = 0; | |
volatile uint16_t ch4_start = 0; | |
volatile uint16_t ch5_start = 0; | |
volatile uint16_t ch6_start = 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
client_config_backend: file | |
client_config_file: client_secrets.json | |
save_credentials: True | |
save_credentials_backend: file | |
save_credentials_file: credentials.json | |
get_refresh_token: True |
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
# patimelapse.py | |
# Timelapse script for taking and uploading images to Google Drive | |
# You must create the client_secrets.json file (see pydrive documentation) | |
# If you want to save your credentials for reuse, you must include the correct | |
# save_credentials values in settings.yaml | |
import time | |
from datetime import datetime, timedelta | |
import picamera | |
from pydrive.drive import GoogleDrive |
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
# fileexample.py | |
# Example code to write data to a file, specifically a comma-separated value format | |
# Dan Fisher, 2014-01-10 | |
import csv | |
measurement1 = 98382.90239481 | |
measurement2 = 79.28593289 | |
# Open a file, then use the csv library to easily write a line of data to the file |
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
# sensorexample.py | |
# Shows how to use the Adafruit library to read pressure and | |
# altitude from the BMP180 | |
import Adafruit_BMP.BMP085 as BMP085 | |
import time | |
# This starts the pressure sensor | |
sensor = BMP085.BMP085() |
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
# displayexample.py | |
# Example program showing how to use the ledmulti library functions | |
# Dan Fisher, 2014-01-10 | |
# updated 2014-01-15 | |
import ledmulti as led | |
import time | |
import RPi.GPIO as GPIO | |
# Displays a number for display_time in seconds, with up to 3 decimal places |