Strange Problem with project
Matthew McCabe
Posts: 2
hi everyone --
i'm having some trouble with a MIDI controller project and i thought the community might be able to help.
i'm using a BS2sx, which i've connected up to a Halex soft-tip dartboard that i've ripped the guts out of. the dart board is constructed with 10 contacts in the front, and 7 in the rear. when one pin from the front touches a pin on the back, you can determine which area of the dart board has been hit.
everything is working fine -- i have P0 through P9 connected to the 10-pin contact sheet with pull-down resistors, and P12, P13, and P14 connected to an 74HCT259 -- a 3-to-8 demultiplexor (since i don't have enough pins to use a pin for each contact point on the board). P10 is being used to send out MIDI messages.
everything is working great -- if i push with my finger down on the dartboard, the stamp sees it and successfully sends out a MIDI message. each region is connected correctly, and i can see the numbers coming in through my MIDI interface.
the trouble is, when i actually throw a dart at the board, it only senses the impact roughly 50-60% of the time. this is opposed to if i push down on the board region, where it detects 100% of time.
here is the code -- i wonder if anyone has a better implementation idea. i can post a schematic if necessary...
' matthew mccabe
' diffusion darts: basic stamp 2sx program
'
' this program detects dart impacts on a hot-rodded Halex dart board
' and sends out MIDI messages
' this program is based on the program given in Nuts and Volts #22
' by scott edwards
'set up variables
key VAR WORD ' area of the board that was struck
tenpin VAR WORD ' input states of pins p0 - p9
regionCode VAR BYTE ' code for identifying each board region
midipin CON 10 ' pin 10 will be used for MIDI serial out
baudmode CON 60 ' 31,250 bps on the bs2sx
outpause CON 0 ' pause between data sends
LOW 12
LOW 13
LOW 14
LOW 15
' here is the main loop. it waits for an impact on a row
' then calls the subroutine to send out the message
mainLoop:
FOR OUTD = 0 TO 6
tenpin.LOWBYTE = INL
tenpin.HIGHBYTE.BIT0 = IN8
tenpin.HIGHBYTE.BIT1 = IN9
IF NCD tenpin <> 0 THEN hitDetected
NEXT
GOTO mainLoop
hitDetected:
key = NCD tenpin
regionCode = key + ((OUTD + 1) * 10)
' DEBUG DEC regionCode, CR
SEROUT midipin, baudmode, outpause, [noparse][[/noparse]$90, regionCode, 127]
SEROUT midipin, baudmode, outpause, [noparse][[/noparse]$90, regionCode, 0]
RETURN
any help would be appreciated!
i'm having some trouble with a MIDI controller project and i thought the community might be able to help.
i'm using a BS2sx, which i've connected up to a Halex soft-tip dartboard that i've ripped the guts out of. the dart board is constructed with 10 contacts in the front, and 7 in the rear. when one pin from the front touches a pin on the back, you can determine which area of the dart board has been hit.
everything is working fine -- i have P0 through P9 connected to the 10-pin contact sheet with pull-down resistors, and P12, P13, and P14 connected to an 74HCT259 -- a 3-to-8 demultiplexor (since i don't have enough pins to use a pin for each contact point on the board). P10 is being used to send out MIDI messages.
everything is working great -- if i push with my finger down on the dartboard, the stamp sees it and successfully sends out a MIDI message. each region is connected correctly, and i can see the numbers coming in through my MIDI interface.
the trouble is, when i actually throw a dart at the board, it only senses the impact roughly 50-60% of the time. this is opposed to if i push down on the board region, where it detects 100% of time.
here is the code -- i wonder if anyone has a better implementation idea. i can post a schematic if necessary...
' matthew mccabe
' diffusion darts: basic stamp 2sx program
'
' this program detects dart impacts on a hot-rodded Halex dart board
' and sends out MIDI messages
' this program is based on the program given in Nuts and Volts #22
' by scott edwards
'set up variables
key VAR WORD ' area of the board that was struck
tenpin VAR WORD ' input states of pins p0 - p9
regionCode VAR BYTE ' code for identifying each board region
midipin CON 10 ' pin 10 will be used for MIDI serial out
baudmode CON 60 ' 31,250 bps on the bs2sx
outpause CON 0 ' pause between data sends
LOW 12
LOW 13
LOW 14
LOW 15
' here is the main loop. it waits for an impact on a row
' then calls the subroutine to send out the message
mainLoop:
FOR OUTD = 0 TO 6
tenpin.LOWBYTE = INL
tenpin.HIGHBYTE.BIT0 = IN8
tenpin.HIGHBYTE.BIT1 = IN9
IF NCD tenpin <> 0 THEN hitDetected
NEXT
GOTO mainLoop
hitDetected:
key = NCD tenpin
regionCode = key + ((OUTD + 1) * 10)
' DEBUG DEC regionCode, CR
SEROUT midipin, baudmode, outpause, [noparse][[/noparse]$90, regionCode, 127]
SEROUT midipin, baudmode, outpause, [noparse][[/noparse]$90, regionCode, 0]
RETURN
any help would be appreciated!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!
can someone post a schematic or a link to a helpful site / pdf / etc. ?
many thanks... i'm having a ball learning about this stuff!