Interactive Punching Bag Project - Presentation III
Tonight we present for class. The following hardware is in place:
Wlodek's Crossover for low frequency microphone input
My mic inside the punching bag
Piezo strip motion sensor sewed to the punching bag
PIC chip and bread board with diode array
MIDI synthesizer
MIDI and audio cables
Amplifier
Speaker
The PIC BASIC PRO code for the PIC is as follows
'****************************************************************
'* Name : week7 MIDI with 1 pot *
'* Author : wk372 *
'* Date : 10/23/2004 *
'****************************************************************
' open the file with the definitions that we need:
INCLUDE "modedefs.bas"
DEFINE OSC 20
Define ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 15 ' Set sampling time in uS
'set up serial UART registers:
DEFINE HSER_RCSTA 90h ' enable the receive register
DEFINE HSER_TXSTA 20h ' enable the transmit register
DEFINE HSER_BAUD 31250 ' set the baud rate
TRISA = %11111111 'set PORTA to all input
'setup ADCON1
ADCON1= %10000010
'declare an aarray of 12 word variables
pitch var byte(12)
'declare other variables
note var byte
ADCVar var word
'the 12 elements of the array called pitch are the 12 notes of a scale
pitch (0) =60 ' middle c
pitch (1) =61 ' C#
pitch (2) =62 ' D
pitch (3) =63 ' D#
pitch (4) =64 ' E
pitch (5) =65 ' F
pitch (6) =66 ' F#
pitch (7) =63 ' G
pitch (8) =68 ' G#
pitch (9) =69 ' A
pitch (10) =70 ' A#
pitch (11) =71 ' B
main
'mypot gave a value of 0 to 1023
ADCin 0, ADCVar
'convert to a range from o to 10
Note = ADCVar / 100
if ADCVar>600 then
'play note
hserout [$90, pitch(note),$40]
pause 250
'noteoff:
hserout[$80, pitch(note), $00]
endif
goto main
Wlodek's Crossover for low frequency microphone input
My mic inside the punching bag
Piezo strip motion sensor sewed to the punching bag
PIC chip and bread board with diode array
MIDI synthesizer
MIDI and audio cables
Amplifier
Speaker
The PIC BASIC PRO code for the PIC is as follows
'****************************************************************
'* Name : week7 MIDI with 1 pot *
'* Author : wk372 *
'* Date : 10/23/2004 *
'****************************************************************
' open the file with the definitions that we need:
INCLUDE "modedefs.bas"
DEFINE OSC 20
Define ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 15 ' Set sampling time in uS
'set up serial UART registers:
DEFINE HSER_RCSTA 90h ' enable the receive register
DEFINE HSER_TXSTA 20h ' enable the transmit register
DEFINE HSER_BAUD 31250 ' set the baud rate
TRISA = %11111111 'set PORTA to all input
'setup ADCON1
ADCON1= %10000010
'declare an aarray of 12 word variables
pitch var byte(12)
'declare other variables
note var byte
ADCVar var word
'the 12 elements of the array called pitch are the 12 notes of a scale
pitch (0) =60 ' middle c
pitch (1) =61 ' C#
pitch (2) =62 ' D
pitch (3) =63 ' D#
pitch (4) =64 ' E
pitch (5) =65 ' F
pitch (6) =66 ' F#
pitch (7) =63 ' G
pitch (8) =68 ' G#
pitch (9) =69 ' A
pitch (10) =70 ' A#
pitch (11) =71 ' B
main
'mypot gave a value of 0 to 1023
ADCin 0, ADCVar
'convert to a range from o to 10
Note = ADCVar / 100
if ADCVar>600 then
'play note
hserout [$90, pitch(note),$40]
pause 250
'noteoff:
hserout[$80, pitch(note), $00]
endif
goto main


<< Home