'{$STAMP BS2}
' MOJOYsticks project by Hugo Desmeules
' SID (sexually interactive device)
' 1 male atari joystick and 1 female atari joystick meets for the first time

clit VAR Nib ' value of the clitronic sensor (pin 5)
light VAR Nib ' value of the light sensor (pin 6)
heat VAR Byte ' value of the thermistor sensor (pin 7)
freq VAR Word ' value of the frequency (speaker pin 8)
beat VAR Word ' timing of the heart beat
speed VAR Word ' speed of the motor (pin 9)
pin VAR Nib ' pin number
steps VAR Nib ' e-motion steps
mojo VAR Word ' amount of sexual drive for the male controller
time VAR Word ' value of time
stick VAR Byte ' total of direction inputs
LED1 CON 10
LED2 CON 11
LED3 CON 12
LED4 CON 13


init:

'INPUT 2
'INPUT 3
'INPUT 4

beat = 1000
'HIGH 7
'PAUSE 1
'RCTIME 7, 1, light ' measures the light level
'RANDOM mojo
'mojo = (mojo/4 + light) MIN 2 ' amount of initial mojo
steps = 0 ' starts unexcited
'speed = 0 ' motor is quiet
time = 0 ' time set
GOTO process

resettime:
time = 0
GOTO process

process:

mojo = mojo MIN 2 'minimum mojo
mojo = mojo - 1 'mojo decreases with time
beat = beat MIN 50 'minimum beat
beat = beat + 5 'beat speed decreases with time
beat = beat - (clit * 2) 'beat speed increases with clitronic activation
time = time + 1 'time increase
HIGH 5 'powers the clitronic capacitor
'HIGH 6 'powers the thermistor capacitor
'HIGH 7 'powers the photosensor capacitor
RCTIME 5, 1, clit ' measures the clitronic state
'SEROUT 14,32780,0,[177,60,clit]
'RCTIME 6, 1, heat ' measures the temperature
'SEROUT 14,32780,0,[178,60,heat]
'RCTIME 7, 1, light ' measures the light level
'SEROUT 14,32780,0,[179,60,light]

'DEBUG ? time
'DEBUG ? clit
DEBUG ? mojo
DEBUG ? beat
'LOW LED1
'LOW LED2
'LOW LED3
'LOW LED4
mojo = mojo + clit - 1 '+ heat - light 'defines the mojo value
'speed = mojo * steps 'defines the speed of motor
FREQOUT 1,beat,(mojo * 10),(mojo MIN 8) - 8 'output to the speaker
SEROUT 16, $4054,[ mojo ]

GOTO process
'GOSUB mojo_up

FOR time = 0 TO 255
time = time + 1
mojo = mojo - 1
'speed = speed - 1
'freq = freq - 1
IF time > 254 THEN resettime
IF mojo > 200 THEN orgasm
IF mojo > 100 THEN plateau
IF mojo > 50 THEN excite
IF mojo = 0 THEN init

NEXT
GOTO process

mojo_up:
'stick = IN0 + IN1 + IN2 + IN3 + IN4
mojo = mojo + clit 'INS
RETURN


GOTO process


excite:
steps = 1
'PULSOUT 9, speed ' pulses the motor for a certain time
'HIGH LED1
HIGH LED2
HIGH LED3
HIGH LED4

GOTO process

plateau:

steps = 2
HIGH 9
FREQOUT 7,225,freq,(freq MIN 8) - 8


FREQOUT 7,225,clit,(freq MIN 8) - 8
SEROUT 16,256,[ mojo ]

GOTO process

orgasm:
steps = 3
HIGH 9
FREQOUT 7,225,freq,(freq MIN 8) - 8
FREQOUT 7,225,clit,(freq MIN 8) - 8
SEROUT 16, $4054,[ mojo ]
HIGH LED1
HIGH LED2
HIGH LED3
HIGH LED4
GOTO process