'{$STAMP BS2}´ '-------------------------------------------------------------------------- ' ' ' ----------[ Title ]------------------------------------------------------ ' ' File........... CryingMachine.bs2 ' Author......... Thomas Charveriat ' E-mail......... tc262@columbia.edu ' WWW............ http://www.montcada5.com ' Date........... March 2002 ' ' ----------[ Program Description ]---------------------------------------- ' ' A computerized electronic thermometer reproduces the sound of continuous crying patterns which ' never repeat themselves. The machine monitors the resistance of the electricity passing through it and, ' by measuring the increase and decrease of this resistance, releases a crying sound in a random pattern. ' While this is happening, the speakers produce additional fluctuations in voltage. This second source ' of resistance works in concert with the first, creating endless random crying combinations. ' ' ----------[ Diagram ]---------------------------------------------------- ' ' __________ ' SER TX <-| 1 24 |-- PWR ' SER RX ->| 2 23 |-- (PWR) GND ' SER ATN ->| 3 22 |-- RESET ' SER GND --| 4 21 |-- +5V ' MIDI I/O 0 ->| 5 20 |-- I/O 15 N/C ' N/C I/O 1 ->| 6 19 |-> I/O 14 N/C ' N/C I/O 2 ->| 7 18 |-- I/O 13 N/C ' N/C I/O 3 ->| 8 17 |-- I/O 12 N/C ' N/C I/O 4 ->| 9 16 |-- I/O 11 N/C ' N/C I/O 5 ->| 10 15 |-- I/O 10 N/C ' N/C I/O 6 ->| 11 14 |-> I/O 9 N/C ' flexcable I/O 7 ->| 12 13 |-> I/O 8 N/C ' |__________| ' ' BS2-IC ' ' ' ----------[ Variables ]-------------------------------------------------- power var byte semipower var byte midi var byte flexcable var byte volume var byte 'A1 is midi=1 c#-2 'A2 is midi=2 d-2 'A3 is midi=3 d#-2 'A4 is midi=4 e-2 'A5 is midi=5 f-2 'A6 is midi=6 f#-2 'A7 is midi=7 g-2 'A8 is midi=8 g#-2 'A9 is midi=9 a-2 'A10 is midi=10 a#-2 'A11 is midi=11 b-2 'A12 is midi=12 c-1 ' ----------[ Initialization ]--------------------------------------------- serout 0,12,0,[176,123,0] 'all notes off ' ----------[ Main Code ]-------------------------------------------------- start random power semipower=power*8 debug?power pwm 1,semipower,40 pause 50 high 7 rctime 7, 1,flexcable debug? flexcable low 7 if flexcable=1 then midi1 if flexcable=2 then midi2 if flexcable=3 then midi3 if flexcable=4 then midi4 if flexcable=5 then midi5 if flexcable=6 then midi6 if flexcable=7 then midi7 if flexcable=8 then midi8 if flexcable=9 then midi9 if flexcable=10 then midi10 if flexcable=11 then midi11 if flexcable=12 then midi12 if flexcable=13 then midi13 if flexcable=14 then midi14 if flexcable=15 then midi15 if flexcable=16 then midi16 if flexcable=17 then midi17 if flexcable=18 then midi18 if flexcable=19 then midi1 if flexcable=20 then midi2 if flexcable=21 then midi3 if flexcable=22 then midi4 if flexcable=23 then midi5 if flexcable=24 then midi6 if flexcable=25 then midi7 if flexcable=26 then midi8 if flexcable=27 then midi9 if flexcable=28 then midi10 if flexcable=29 then midi11 if flexcable=30 then midi12 if flexcable=31 then midi13 if flexcable=32 then midi14 if flexcable=33 then midi15 if flexcable=34 then midi16 if flexcable=35 then midi17 if flexcable=36 then midi18 if flexcable=37 then midi1 if flexcable=38 then midi2 if flexcable=39 then midi3 if flexcable=40 then midi4 if flexcable=41 then midi5 if flexcable=42 then midi6 if flexcable=43 then midi7 if flexcable=44 then midi8 if flexcable=45 then midi9 if flexcable=46 then midi10 if flexcable=47 then midi11 if flexcable=48 then midi12 if flexcable=49 then midi13 if flexcable=50 then midi14 if flexcable=51 then midi15 if flexcable=52 then midi16 if flexcable=53 then midi17 if flexcable=54 then midi18 if flexcable=55 then midi1 if flexcable=56 then midi2 if flexcable=57 then midi3 if flexcable=58 then midi4 if flexcable=59 then midi5 if flexcable=60 then midi6 if flexcable=61 then midi7 if flexcable=62 then midi8 if flexcable=63 then midi9 if flexcable=64 then midi10 if flexcable=65 then midi11 if flexcable=66 then midi12 if flexcable=67 then midi13 if flexcable=68 then midi14 if flexcable=69 then midi15 if flexcable=70 then midi16 if flexcable=71 then midi17 if flexcable=72 then midi18 if flexcable=73 then midi1 if flexcable=74 then midi2 if flexcable=75 then midi3 if flexcable=76 then midi4 if flexcable=77 then midi5 if flexcable=78 then midi6 if flexcable=79 then midi7 if flexcable=80 then midi8 if flexcable=81 then midi9 if flexcable=82 then midi10 if flexcable=83 then midi11 if flexcable=84 then midi12 if flexcable=85 then midi13 if flexcable=86 then midi14 if flexcable=87 then midi15 if flexcable=88 then midi16 if flexcable=89 then midi17 if flexcable=90 then midi18 if flexcable=91 then midi1 if flexcable=92 then midi2 if flexcable=93 then midi3 if flexcable=94 then midi4 if flexcable=95 then midi5 if flexcable=96 then midi6 if flexcable=97 then midi7 if flexcable=98 then midi8 if flexcable=99 then midi9 if flexcable=100 then midi10 if flexcable=101 then midi11 if flexcable=102 then midi12 if flexcable=103 then midi13 if flexcable=104 then midi14 if flexcable=105 then midi15 if flexcable=106 then midi16 if flexcable=107 then midi17 if flexcable=108 then midi18 if flexcable=109 then midi1 if flexcable=110 then midi2 if flexcable=111 then midi3 if flexcable=112 then midi4 if flexcable=113 then midi5 if flexcable=114 then midi6 if flexcable=115 then midi7 if flexcable=116 then midi8 if flexcable=117 then midi9 if flexcable=118 then midi10 if flexcable=119 then midi11 if flexcable=120 then midi12 if flexcable=121 then midi13 if flexcable=122 then midi14 if flexcable=123 then midi15 if flexcable=124 then midi16 if flexcable=125 then midi17 if flexcable=125 then midi18 if flexcable=126 then midi1 if flexcable=127 then midi2 if flexcable=128 then midi3 if flexcable=129 then midi4 if flexcable=130 then midi5 if flexcable=131 then midi6 if flexcable=132 then midi7 if flexcable=133 then midi8 if flexcable=134 then midi9 if flexcable=135 then midi10 if flexcable=136 then midi11 if flexcable=137 then midi12 if flexcable=138 then midi13 if flexcable=139 then midi14 if flexcable=140 then midi15 if flexcable=141 then midi16 if flexcable=142 then midi17 if flexcable=143 then midi18 if flexcable=144 then midi1 if flexcable=145 then midi2 if flexcable=146 then midi3 if flexcable=147 then midi4 if flexcable=148 then midi5 if flexcable=149 then midi6 if flexcable=150 then midi7 if flexcable=151 then midi8 if flexcable=152 then midi9 if flexcable=153 then midi10 if flexcable=154 then midi11 if flexcable=155 then midi12 if flexcable=156 then midi13 if flexcable=157 then midi14 if flexcable=158 then midi15 if flexcable=159 then midi16 if flexcable=160 then midi17 if flexcable=161 then midi18 if flexcable=237 then midi1 if flexcable=238 then midi2 if flexcable=239 then midi3 if flexcable=240 then midi4 if flexcable=241 then midi5 if flexcable=242 then midi6 if flexcable=243 then midi7 if flexcable=244 then midi8 if flexcable=245 then midi9 if flexcable=246 then midi10 if flexcable=247 then midi11 if flexcable=248 then midi12 if flexcable=249 then midi13 if flexcable=250 then midi14 if flexcable=251 then midi15 if flexcable=252 then midi16 if flexcable=253 then midi17 if flexcable=254 then midi18 goto start ' ----------[ Subroutines ]------------------------------------------------ midi1:midi=1:goto envoyer midi2:midi=2:goto envoyer midi3:midi=3:goto envoyer midi4:midi=4:goto envoyer midi5:midi=5:goto envoyer midi6:midi=6:goto envoyer midi7:midi=7:goto envoyer midi8:midi=8:goto envoyer midi9:midi=9:goto envoyer midi10:midi=10:goto envoyer midi11:midi=11:goto envoyer midi12:midi=12:goto envoyer midi13:midi=1:goto envoyer midi14:midi=2:goto envoyer midi15:midi=3:goto envoyer midi16:midi=4:goto envoyer midi17:midi=5:goto envoyer midi18:midi=6:goto envoyer goto start envoyer: volume=power max 127 debug?volume serout 0,12,0,[144,midi,volume] serout 0,12,0,[128,midi,volume] debug?midi pause power*30 goto start