; Cricket Logo code for Lab 3 global [ val ] to son ;send the command to get sonar value bsend $180 ;receive the distance from the logochip setval bsr 0 ; if val > 10, make it 10 if val > 10 [setval 10] if val = -1 [setval 10] ; now beep, with delays betwen beeps comensurate with inverse distance ; boop val ; note (val * 20 - 10) 1 beep ; wait and repeat wait (val + 1) son end to boop :n repeat 2 [beep wait :n] end