Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

[size=16][highlight][color=#ff0000][b]This forum is now [u]READ-ONLY[/u]! Please visit [url]http://forum.wiring.co/[/url] for the new forum.[/b][/color][/highlight][/size]

Wiring ForumWiring HardwareTangible computing › streaming sound + range finder

Page Index Toggle Pages: 1
streaming sound + range finder (Read 6399 times)
05/08/07 at 21:07:53

nooodles   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 9
*
 
i'm interested in using a range finder to play (turn on and off) audio streams. if the sensor reading is a certain number, the audio would be heard. i've tried the Ess library with Processing, but got stuck when trying to integrate it with the wiring platform. wondering if any one has made a successful attempt at integrating such processing codes with wiring and sensors.

if anyone can reply with some similar or relevant examples would be great!!

thx!

Roll Eyes
 
IP Logged
 
Reply #1 - 05/09/07 at 05:47:25

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
There are examples about interfacing Wiring and Processing here http://wiring.org.co/learning/index.html , what sort of sensore are you planning to use? Wiring can communicate with Wiring using the Serial port. There is also an OSC library in the Reference/Libraries section.
 
IP Logged
 
Reply #2 - 05/14/07 at 17:34:18

nooodles   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 9
*
 
thanks for the reply.

while waiting for my range finders to arrive, i tried the following example:

http://wiring.org.co/learning/examples/lightsensor_serial.html

the light sensor is sending values and can see the reading in the wiring console. however, i am having trouble with the processing portion. yesterday, the applet was drawing a light gray box. i tried shining various light sources to the sensor to affect the applet, but nothing happened. this morning, i fixed permissions on my powerbook and restarted. when i ran the processing program again, the applet is now drawing a black box. again, i tried shining various light sources, still there doesnt seem to be any affect.

any ideas?
 
IP Logged
 
Reply #3 - 05/15/07 at 02:38:53

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
Please post the code you're running to have a better idea.
 
IP Logged
 
Reply #4 - 05/15/07 at 03:53:24

nooodles   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 9
*
 
kept trying the code found on that page, then decided to try another way... i'm just trying to get a handle on using the sensor values at the moment... when i set the delay in the "loop" to 100ms, the processing applet box flickers intermittently between white and black. i can see the sensor value being read, but not sure how it is supposed to affect the fill value.

---code for the wiring part---

int val;
int inputPin = 0;     // Set the input to analog in pin 0

void setup() {
 Serial.begin(9600); // Start serial communication at 9600 bps
}

void loop() {
 val = analogRead(inputPin)/4; // Read analog input pin, put in range 0 to 255
 Serial.print(val, BYTE);      // Send the value
 delay(1000);                   // Wait 1000ms for next reading
}

---for the processing code, i adapted tom igoe's serial example with the processing example found at the lightsensor_serial tutorial page---

// Example by Tom Igoe

import processing.serial.*;

Serial myPort;  // The serial port
int val;     // Data received from the serial port

void setup() {
 // List all the available serial ports
 println(Serial.list());
 // I know that the first port in the serial list on my mac
 // is always my  Keyspan adaptor, so I open Serial.list()[0].
 // Open whatever port is the one you're using.
 myPort = new Serial(this, Serial.list()[3], 9600);
 size(200, 200);
 noStroke();
 frameRate(10); // Run 10 frames per second
}

void draw() {
 while (myPort.available() > 0) {
   int inByte = myPort.read();
   println(inByte);
   val = myPort.read();        // read it and store it in val
 }
 background(204);            // Clear background
 fill(val);                  // Set fill color with the value read
 rect(50, 50, 100, 100);     // Draw square - left, top, width, height
}


---thanks---
 
IP Logged
 
Page Index Toggle Pages: 1