September 30, 2003

Image Control in Max

hey. just checking in to see if anyone is actually using this. thanks for posting the pics, perry.

I was hoping to see some more posts here, but I guess everyone hasn't had any problems with the project. I've gotten the stamp communicating with max, but have a feeling that my trasmit wire on my serial cable was soltered in a pretty pathetic manner, so I need to go back and fix that...

anyway, I wanted to make a quick post referencing the project, and possible implementations of the graphic of the light bulb turning on and off in max. this can be done many ways, but the easiest is probably swapping image files using the fpic object, which looks like a little series of orange, pink, and purple shapes on the top object bar. you can also just type fpic into a new object box. the help file shows how to swap images in and out of the object -- just bang a message with the image file name into the object, and it will change. that way, you can just use perry's patch for the serial object, and then send that bang from the select object (when the switch is on) to a message like light_on.jpg, and then send the output of that message into the left inlet of fpic. Similarly, when the switch is off, send a bang to something like light_off.jpg, and then feed that to fpic. this is a good primer to max, as much of the stuff you end up doing is firing bangs to messages, then sending those messages to objects.

Posted by will at 12:18 PM | Comments (4)

September 27, 2003

Microcontroller Madness: Class Pix 9/25/03

DSCN5778.jpg
View image

DSCN5779.jpg
'where's that resistor?'

DSCN5782.jpg
View image

Posted by at 09:03 AM | Comments (0)

September 25, 2003

Basic Stamp 2 code for communicating with MaxMSP

'{$STAMP BS2}

'BASIC STAMP 2 FIRST PROJECT - COMMUNICATION WITH MAX/MSP

'WHAT SHOULD HAPPEN:
'When a serial message is received on pin 2, the light is turned on or off.
'When the switch is opened or closed, a serial message is sent out on pin 3.

'NOTE: after downloading this program, remove the programming cable from the
'Mac serial port, and plug in the custom serial cable to communicate with Max/MSP.
'Also, you will have to quit out of MacBS2 (or Virtual PC) before you run Max/MSP.

'DECLARE INS & OUTS
input 0 'switch
output 1 'relay
input 2 'BS2 serial receive, mac TXD (transmit)
output 3 'BS2 serial transmit, mac RXD (recieve)

'DECLARE VARIABLES
prevSwitchState var bit
serButtonByte var byte 'serial input from Mac - 1 for button down, 2 for button up

'INITIALIZE VARIABLES
prevSwitchState = 0 'start with switch off

'MAIN LOOP

TOP:
serIn 2,16468,50,CHECKSWITCH,[serButtonByte] 'branch to CHECKSWITCH if 50 ms pass
if serButtonByte = 2 then LIGHTON
if serButtonByte = 1 then LIGHTOFF

CHECKSWITCH:
if in0 <> prevSwitchState then ONOROFF 'branch if switch state changed
goto TOP

LIGHTON:
high 1 'turn on light
'debug "Light ON",cr
serOut 3,16468,["light_ON_"] 'report light on
goto TOP

LIGHTOFF:
low 1 'turn off light
'debug "Light OFF",cr
serOut 3,16468,["light_OFF"] 'report light off
goto TOP

ONOROFF:
if in0 = 1 then SWITCHON 'if 1 then switch on
if in0 = 0 then SWITCHOFF 'if 0 then switch off
goto TOP

SWITCHON:
prevSwitchState = 1
'debug "Switch ON",cr
serOut 3,16468,["switch_ON"] 'report switch on
goto TOP

SWITCHOFF:
prevSwitchState = 0
'debug "Switch OFF",cr
serOut 3,16468,["switchOFF"] 'report switch off
goto TOP

Posted by at 08:45 PM | Comments (1)

Basic Stamp 2 code to switch lamp on and off

'{$STAMP BS2}

'BASIC STAMP 2 FIRST PROJECT V1 - SWITCH LIGHT ON & OFF

'WHAT SHOULD HAPPEN:
'When the switch is closed, the light goes on.

'DECLARE INS & OUTS
input 0 'switch
output 1 'relay

'DECLARE VARIABLES
prevSwitchState var bit

'INITIALIZE VARIABLES
prevSwitchState = 0 'start with switch off

'MAIN LOOP

TOP:
if in0 <> prevSwitchState then ONOROFF 'branch if switch state changed
goto TOP

ONOROFF:
if in0 = 1 then LIGHTON 'if 1 then switch on
if in0 = 0 then LIGHTOFF 'if 0 then switch off
goto TOP

LIGHTON:
prevSwitchState = 1
high 1 'turn on light
debug "light should be ON...",cr
goto TOP

LIGHTOFF:
prevSwitchState = 0
low 1 'turn off light
debug "light should be OFF...",cr
goto TOP

Posted by at 08:44 PM | Comments (0)

Basic Stamp circuits & Max patch

View Basic Stamp 2 Circuits

View Max Patch

Posted by at 08:26 PM | Comments (2)

Welcome!

mad.jpg
... to my laboratory/nightmare/whatever!

Posted by at 03:07 PM | Comments (0)

First Post

hey everybody!

here is a test post. AND NO STINK BOMBS!!!

Posted by admin at 02:49 PM | Comments (0)