Skip to content

Instantly share code, notes, and snippets.

View schappim's full-sized avatar
💤
Sleeping . +10GMT

Marcus S schappim

💤
Sleeping . +10GMT
View GitHub Profile
@schappim
schappim / ControlTheRGBLED.sh
Created October 12, 2012 05:38
Control the RGB LED
curl -H 'Content-Type: application/json' \
-X 'PUT' \
-i "https://api.ninja.is/rest/v0/device/2712BB000674_0_0_1000?user_access_token=19456e8f-8142-4df6-86ef-763154f98d29" \
-d '{"DA":"FFFFFF"}'
#define CLOCKWISE LOW
#define COUNTERCLOCKWISE HIGH
void stepperSteps( long n ) {
digitalWrite( DIR_PIN, n < 0 ? COUNTERCLOCKWISE : CLOCKWISE );
digitalWrite( ENABLE_PIN, LOW );
n = abs( n );
for( ; n > 0; n-- ) {
PORTB |= _BV(PINB1); // WAY faster than digitalWrite
delayMicroseconds( 50 );
#include <MicroView.h>
#include <SPI.h>
void setup() {
uView.begin();
}
void loop() {
uView.print("HELLO WORLD!");
uView.display();
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = A3;
#!/usr/bin/env python
# Open the file that we viewed earlier so that python can see what is in it. Replace the serial number as before.
tfile = open("/sys/bus/w1/devices/10-000802824e58/w1_slave")
# Read all of the text in the file.
text = tfile.read()
# Close the file now that the text has been read.
tfile.close()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import tweepy
#!/usr/bin/env python
# Open the file that we viewed earlier so that python can see what is in it. Replace the serial number as before.
@schappim
schappim / testing_python.py
Created April 25, 2014 08:44
A Python Demo Script
print "Start Loop"
w=20
for i in range(w):
# Repeat the following command 'w' number of times
start = ">" # The start
spaces = " "*(w-i) # Generate the spaces
dots = "."*i*2 # Generate the dots
end = "<"
linenumber = " "+str(i)
print(start+spaces+dots+spaces+end+linenumber)
import sys
pin = int(sys.argv[1].rstrip())
print pin
import RPi.GPIO as GPIO ## Import GPIO library
GPIO.setmode(GPIO.BOARD) ## Use board pin numbering
GPIO.setup(pin, GPIO.OUT) ## Setup GPIO Pin to OUT
state = False
while 1:
command = raw_input("wait for key")
GPIO.output(pin,state) ## Turn on GPIO pin
#!/usr/bin/env ruby
# Dropping out to the shell to: Setup w1-gpio module
`sudo modprobe w1-gpio`
# Dropping out to the shell to: Setup w1-therm module
`sudo modprobe w1-gpio`
# Get a list of files and paths inside our w1 devices directory
# The list of files is returned as an array called paths
@schappim
schappim / virtual-iot-workshop.md
Last active August 29, 2015 14:00
Raspberry Pi Virtual IoT Workshop

Finding our Raspberry Pi

You might need to install nmap on your computer first!

sudo nmap -sP 10.0.1.1-255

Installing Ruby Headers

sudo apt-get install ruby1.9.1-dev;