'{$STAMP BS2} '------------------------------------------ 'soundr.bs2 - Record 30 messages ' 'This program allows you to record 30 messages of '2 seconds each. 'Make sure jumper X2 is on pins 1 and 2 to enable the 'microphone before recording your message. 'To operate, press SW1 to begin recording. 'after 2 seconds, the robot will beep. 'Then press SW1 again to begin recording the next message. 'Continue until all are recorded (30 total). 'You can then press SW2 to play each message. r var byte 'Record Message counter p var byte 'Play Message counter Start: r = 0 'Init message counters p = 0 pause 500 'Start up delay serout 7,188+$8000,["!SM0N"] 'Enable recording sw: if in14=0 then rec 'If SW1 pressed then record if in15=0 then pla 'If SW2 pressed then play goto sw 'Loop until button pushed rec: p = 0 'Restart play counter serout 7,188+$8000,["!SM0R",(r*5)] 'Record 2 sec pause 1950 'Wait till record done. serout 7,84+$8000,["!SM0E"] 'End recording pause 50 'cover up the beep :) freqout 9,100,2000 'beep if r = 29 then rec1 'If no more space then done r = r + 1 'Point to next message goto sw 'Message loop. rec1: r = 0 'Overflow to beginning pause 50 'Delay between beeps freqout 9,100,2000 'Second beep goto sw 'Done with recording pla: r = 0 'Restart record counter serout 7,188+$8000,["!SM0P",(p*5)] 'Play message pause 2000 'Wait till played if p = 29 then pla1 'Last message? p = p + 1 'Point to next message goto sw 'Done with playing pla1: p = 0 'Overflow to beginning goto sw 'Done with playing