'DORK/BOT 'code to run variable resistor inputs 'accelerometer, switches, and MIDI out '/*************************************/ ' Useful variables and constants for MIDI noteonbyte con 144 noteoffbyte con 128 controller con 176 bend con 224 note var byte velocity var byte channel var byte '/*************************************/ fsr var word fsr2 var word accel1 var word accel2 var word loop: 'variable resistance inputs 'on pins 15 and 1 'set the pins (pin 15 and 1) high high 15 high 1 'wait for them to (dis)charge pause 1 'measure how long them takes to drain (charge) rctime 15, 1, fsr rctime 1, 1, fsr2 fsr = fsr / 96 if fsr < 127 then skipscale fsr = 127 skipscale: note = 1 velocity = fsr gosub controlOut if fsr2 < 127 then skipscale2 fsr2 = 127 skipscale2: note = 2 velocity = fsr2 gosub controlOut 'print out the values debug "val1 = ", DEC fsr debug " val2 = ", DEC fsr2, cr 'make douglas happy and 'blink the LED 'high 4 'pause fsr / 100 'low 4 'check the switch on pin 8 if IN8 = 1 then on if IN8 = 0 then off 'read the accelerometer pulsin 6, 1, accel1 pulsin 7, 1, accel2 'debug "Accel1 = ", DEC accel1 'debug " Accel2 = ", DEC accel2, cr goto loop on: 'debug "switch is ON, yippeeeee!!!", cr high 4 'turn on the LED return off: 'debug "switch is OFF, bummer", cr low 4 'turn off the LED return controlOut: serout 11, 12, 0, [controller + channel, note, velocity] return