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
require 'rubygems' | |
require 'midiator' | |
include MIDIator::Notes | |
# don't ask, just be a good sheep.. | |
# http://www.ruby-forum.com/topic/123503 | |
Kernel::require "serialport.so" | |
#params for serial port | |
port_str = "/dev/tty.usbserial-A6006eSL" #may be different for you |
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
/* | |
sends serial data over usb to be converted by ruby to MIDI.. | |
*/ | |
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
require 'widgets/slider_widget' | |
Shoes.app(:title => "slider test", :width => 200, :height => 250) do | |
stack do | |
slider do |pos| | |
@t.text = "pos: #{pos}" | |
end | |
end | |
stack do |
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
class TuioAnimation | |
def initialize | |
@client = TuioClient.new | |
end | |
def nextFrame(view) | |
@client.tuio_cursors.each do |id, cursor| | |
view.do_something_with_cursor(cursor.x_pos) | |
end | |
end |
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
require 'yaml' | |
YAML.load "{product_id: 4000-00-02}" |
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
# SketchUp sockets are horrible | |
# try this out, but i get a random amount of garbage on the ends of the strings | |
# when it reaches SketchUp | |
require "socket" | |
gs = TCPserver.open(3333) | |
addr = gs.addr | |
addr.shift # removes "AF_INET" | |
printf("server is on %s\n", addr.join(":")) |
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
# Show the Ruby Console at startup so we can | |
# see any programming errors we may make. | |
Sketchup.send_action "showRubyPanel:" | |
# This is an example of a simple animation that floats the camera up to | |
# a z position of 200". The only required method for an animation is | |
# nextFrame. It is called whenever you need to show the next frame of | |
# the animation. If nextFrame returns false, the animation will stop. |
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
def self.new_with_time( address, time, tags=nil, *args ) | |
message = new( address, tags, *args ) | |
message.time = time | |
message | |
end | |
def initialize(address, tags=nil, *args) |
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
require 'rubygems' | |
require 'eventmachine' | |
require File.join( File.dirname( __FILE__), '..', 'osc-ruby') | |
module OSC | |
Channel = EM::Channel.new | |
class Connection < EventMachine::Connection |
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 <Servo.h> | |
Servo my_servo; // create servo object to control a servo | |
int servo_angle = 0; | |
int sensor_pin = 2; | |
int servo_pin = 9; | |
int scan_values[180]; |
OlderNewer