Skip to content

Instantly share code, notes, and snippets.

View solon's full-sized avatar
🐝

Brian Solon solon

🐝
View GitHub Profile
# WIP of http://wiki.processing.org/w/Ruby_Comparison
# Based on http://wiki.processing.org/w/Python_Comparison
# todo:
# - write intro paragraph on Ruby
# - add more examples
# - add a separate RubyProcessing_Comparison wiki entry for ruby-processing
# [http://wiki.github.com/jashkenas/ruby-processing/]
# Data
x = 70 # Initialize
<?php
/*
* Display a sensor value on a webpage
* Uses the Pachube PHP Library - download at http://community.pachube.com/tutorials/php
*/
require_once('pachube_functions.php');
// Obtain your API key here: http://www.pachube.com/users/my_username/settings
<html>
<head>
<title>Changing webpage contents in response to a light sensor</title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<style type="text/css">
body {
margin:0;
padding:50px;
text-align:center;
background-color:#ccc;
We couldn’t find that file to show.
<?php
/*
* sendTweet.php
*
* To send a tweet, request the URL of this script with a status parameter like this:
* http://localhost/sendTweet.php?status=this is a test tweet
*/
$status = $_GET['status'];
$username = "YOUR_TWITTER_USERNAME";
char pachube_data[70];
boolean found_status_200 = false;
boolean found_session_id = false;
boolean found_CSV = false;
char *found;
unsigned int successes = 0;
unsigned int failures = 0;
boolean ready_to_update = true;
boolean reading_pachube = false;
/*
* light_mirror.pde
* Turns on an LED when it's bright in a remote location and vice versa
* Remote location is set to the Pachube office feed but this can easily be changed
*/
/* ==============================
* This code, which assumes you're using the official Arduino Ethernet shield,
* updates a Pachube feed with your analog-in values and grabs values from a Pachube
* feed - basically it enables you to have both "local" and "remote" sensors.
/*
* skype_status.pde
* Turns on an LED when a Skype user is online and vice versa
* See http://apps.pachube.com/onlinestatus/online-status.php for more info and setup instructions.
*/
/* ==============================
* This code, which assumes you're using the official Arduino Ethernet shield,
* updates a Pachube feed with your analog-in values and grabs values from a Pachube
* feed - basically it enables you to have both "local" and "remote" sensors.
require 'rubygems'
require 'sinatra'
require 'data_mapper'
require 'carrierwave'
require 'carrierwave/orm/datamapper'
ROOT = Dir.pwd
class ImageUploader < CarrierWave::Uploader::Base
storage :file
@solon
solon / AnalogSelectWav.pde
Created February 7, 2011 15:07
Arduino program to divide an analog sensor into a number of discrete ranges and trigger a different WAV file when the sensor value enters one of the ranges.
// these are constants that won't change while the code is running
const int lowerBound = 0;
const int threshold1 = 350;
const int threshold2 = 700;
const int upperBound = 1024;
// these variables will change
int sensorValue = 0;
int lastRange = 0;