Tuesday, October 27, 2009

Arduino Code from lab


void setup()
{
Serial.begin(57600);
}
void loop()
{
//int analogData = analogRead(0);//10 bit value, max 1023, min 0.
int analogDataPin0 = analogRead(0);//Read Current analog pin value.
Serial.print(analogDataPin0 >> 7, BYTE);//shift high bits into output byte
//same as dividing by 128 But that
//takes much longer on an arduino.
Serial.print(analogDataPin0 % 128, BYTE);//mod 128 for the small byte
Serial.print(255, BYTE);//denotes the end of a package.
delay(10);
}
This particular code snippet works for one source of information, ie: a single sensor. If, perhaps there were to be two sections of information, say, a switch, there would be another Serial.print line. It would just print 0 or 1, but you could map that to some interesting effects in max.

Always be sure to watch your outputs from the zl group object to cover the extra inputs.


Wednesday, October 7, 2009

Week 5 Lecture

Sounds and ideas for your performance....

http://www.youtube.com/watch?v=VX5V_9s0Gfw&feature=related

Create a mock tesla coil with am LDR and a light source. Use samples similar to the sounds above or in the ghostbusters one.

Project is limited to;
2 continuous, 2 discrete, no screen, no mouse, one mic, one acoustic instrument and props. That's it!

Tuesday, October 6, 2009

Week 5 Lab

Using the arduino's internal pull-up


code to turn on pull-up

void setup(){
pinMode(3, INPUT);
digitalWrite(3,HIGH);}
void loop(){
int digin = digitalRead(3);
}
Arduino Serial

Serial transmission is one bit sent at a time. Serial speeds can range from 9.6k to 115.2k, but for practical reasons we mostly use 57.6k. That is the same speed as good old dial-up tinternets.

Impratical example of code*
void setup()
{
Serial.begin(57600);
}

void loop()
{
Serial.print(1);
delay (500);
}
This will print out the ASCII value for one every half second. This in and of itself is utterly useless, unless something is listening on the computer and knows what to do with that 49. so instead of worrying about the encoding values, we can get Serial.print to pass information as is. We do this by adding in the argument BYTE. Thus the new code would look like "Serial.print(1, BYTE);"

Sample Lab Test Question;
Build a light controlled oscillator using a Light Dependant Resistor, a potential divider, arduino and MaxMSP.
Solution:

Thursday, October 1, 2009

Lec 2 - 15/09/09

Hardware (electronics and stuff) -> MaxMSP wizadry -> speakers

MaxMSP has Objects (functions), Message boxes (used for sending variables to an object), Number boxes (send info of type int/float)

Objects~ is a signal object. like cycle~. A signal object means that there is always 44,100 numbers coming out of that object every second.

How would you we control this without screen or mouse?
list all the parameters and actions you need to deal with.
select and load....
select start and end.... How do you deal with different sample lengths?


Divide the slider into 3, and allow the performer to either A) play backwards at regular/slow speed, B) playback slowly, C) playback at regular speed or D) playback faster than normal.
Also set it up so that the user can load a sound without seeing the instrument!! VERY IMPORTANT!

Looping point, -> set start and width. ->use some other thing to control it.... another twisty knob yoke?
Set something that will allow the user to just straight hit one button and then go time.

Lecture 1 09/09/09

Basic Intro to Electricity


  • Voltage

  • Current

  • Resistence


Never create a short circuit. = Electricity will flow from the positive to the negetive insanely fast and fry the wire.

Voltage = pressure. Of a battery = 1.5V == the pressure difference from the positive to negetive. Measured with a voltmeter. Voltage also = potential difference.


Current is a measure of the amount of electricity that is flowing. (symbol = i)

The unit of current is the Amp.


Resistence = a measure of how well it resists the flow of electricity. Resistence is measured in Ohms. 100 ohms is about the same as a 60W lightbulb. In electronics, we mostly deal in 1Kohms or 10Kohms. The Resistence of a human (Rh) is roughly 1Mohm (1 mega ohm).


Voltage = 1.5V

I at 100ohms = X

I at 1Kohms = Y

X>Y


Ohms Law, V= IR where V = Volts, I = Amps, R = Ohms.


Voltage across something, current through it.

In electronics we deal with milliamps. mA.


Simple sensor circuit is created with 5V and two resistors. Each at 10Kohms.

Two 10Kohm resisters in series create a total resistence of 20Kohms. Rtotal = R1 + R2.

note

Current remains the same throughout a circuit, but the voltage drops through resisters.


Rt = 20Kohms, V = 5, V =IR => I = V/R = 5/20000 = 0.25mA.


Notes at http://seattlerobotics.org/guide/electronics.html