Option Explicit 'define variable types dim RedSwitch as byte dim GreenSwitch as byte dim RedLED as byte dim GreenLED as byte dim redScore as integer dim greenScore as integer Public Sub Main() 'initialize pin vars redSwitch = 14 greenSwitch = 13 redLED = 11 greenLED = 12 redScore = 0 greenscore = 0 do debug.print "ready?" call Delay(3.0) ' make sure no one presses button too soon? ' if someone presses a button, ' subtract 1 point! debug.print "GO!" do 'looking for switch to be pressed if getPin(redSwitch) = 1 then call flashRed() ' increase red player's score redScore = redScore + 1 exit do end if if getPin(greenSwitch) = 1 then call flashGreen() ' increase green player's score greenScore = greenScore + 1 exit do end if loop 'display scores so far debug.print "score!" debug.print "red: " & cStr(redScore) debug.print "grn: " & cStr(greenScore) debug.print "" loop End Sub Sub flashRed() call putPin(redLED, 1) call Delay(0.1) call putPin(redLED, 0) call Delay(0.1) call putPin(redLED, 1) call Delay(0.1) call putPin(redLED, 0) End Sub Sub flashGreen() call putPin(greenLED, 1) call Delay(0.1) call putPin(greenLED, 0) call Delay(0.1) call putPin(greenLED, 1) call Delay(0.1) call putPin(greenLED, 0) End sub