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 | |
import time | |
import os | |
STEP = 100 | |
DELAY = 0.5 | |
def pwm(pin, angle): | |
print "servo[" + str(pin) + "][" + str(angle) + "]" |
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 | |
import smtplib | |
from email.MIMEMultipart import MIMEMultipart | |
from email.MIMEBase import MIMEBase | |
from email.MIMEText import MIMEText | |
from email.Utils import COMMASPACE, formatdate | |
from email import Encoders | |
import os | |
USERNAME = "username@gmail.com" |
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 | |
import smtplib | |
from email.mime.text import MIMEText | |
USERNAME = "username@gmail.com" | |
PASSWORD = "password" | |
MAILTO = "mailto@gmail.com" | |
msg = MIMEText('This is the body of the email') | |
msg['Subject'] = 'The email subject' |
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 | |
import feedparser | |
USERNAME = "username@gmail.com" | |
PASSWORD = "password" | |
response = feedparser.parse("https://" + USERNAME + ":" + PASSWORD + "@mail.google.com/gmail/feed/atom") | |
unread_count = int(response["feed"]["fullcount"]) | |
for i in range(0,unread_count): |
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
/******************************************************* | |
* SerialServoControl Sketch | |
* Written by Ryan Owens for SparkFun Electronics | |
* 7/15/11 | |
* | |
* This sketch listens to serial commands and uses the data | |
* to set the position of two servos. | |
* | |
* Serial Command Structure: 2 bytes - [ID Byte][Servo Position byte] | |
* ID byte should be 0 or 1. |
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 | |
import serial, sys, time, psutil | |
# Assign Arduino's serial port address | |
# Windows example | |
# usbport = 'COM3' | |
# Linux example | |
# usbport = '/dev/ttyUSB0' | |
# MacOSX example | |
# usbport = '/dev/tty.usbserial-FTALLOK2' |
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 RPi.GPIO as GPIO, feedparser | |
USERNAME="username@gmail.com" | |
PASSWORD="password" | |
GPIO_PIN=12 | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(GPIO_PIN, GPIO.OUT) | |
newmails = int(feedparser.parse("https://" + USERNAME + ":" + PASSWORD + "@mail.google.com/gmail/feed/atom")["feed"]["fullcount"]) | |
if newmails > 0: | |
GPIO.output(GPIO_PIN, True) | |
else: |
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
/* Arduino USB Keyboard HID demo | |
* Cut/Copy/Paste Keys | |
*/ | |
#define KEY_LEFT_CTRL 0x01 | |
#define KEY_LEFT_SHIFT 0x02 | |
#define KEY_RIGHT_CTRL 0x10 | |
#define KEY_RIGHT_SHIFT 0x20 | |
uint8_t buf[8] = { |
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
/* Arduino USB HID Keyboard Demo | |
* Random Key/Random Delay | |
*/ | |
uint8_t buf[8] = { | |
0 }; /* Keyboard report buffer */ | |
void setup() | |
{ | |
Serial.begin(9600); |
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
/* Arduino USB Keyboard HID demo | |
* Volume+/Volume-/Mute keys | |
*/ | |
uint8_t buf[8] = { | |
0 }; /* Keyboard report buffer */ | |
#define PIN_VOLUME_UP 5 | |
#define PIN_VOLUME_DOWN 6 | |
#define PIN_MUTE 7 |
NewerOlder