def car_backward_test(): print("back using back") for speed in list(range(0, 101, 20)): print("back speed: %d" % speed) rocky.back(speed, 1) for speed in list(range(0, 101, 20)): print("back speed: %d" % -speed) rocky.back(-speed, 1)
def rocky_send(): print("rocky forward") rocky.forward(100, 2) print("rocky back") rocky.back(100, 2) print("rocky left") rocky.left(100, 2) print("rocky right") rocky.right(100, 2) print("rocky stop")
def on_button_callback(): global angerValue if angerValue > random.randint(3, 5): angerValue = 0 time.sleep(0.2) codey.face('00003c1e0e0400000000040e1e3c0000') rocky.back(50) time.sleep(0.4) codey.say('dog.wav') codey.face('00007c3e1e0e040000040e1e3e7c0000') rocky.back(100) time.sleep(0.05) rocky.forward(100) time.sleep(0.5) rocky.back(100) time.sleep(0.01) rocky.stop() time.sleep(0.2) else: codey.say('wrong.wav') codey.face('00081c1c3c3820000020383c1c1c0800') time.sleep(0.3) rocky.back(20) codey.face('00040e0e1e1c100000101c1e0e0e0400') rocky.back(50) time.sleep(0.1) codey.face('00081c1c3c3820000020383c1c1c0800') rocky.stop() time.sleep(0.3) codey.face('00183c3c7c7820000020787c3c3c1800') time.sleep(0.1) codey.face('00003c7e7e3c000000003c7e7e3c0000') angerValue = (angerValue if isinstance(angerValue, int) or isinstance(angerValue, float) else 0) + 1 codey.message(str('hello'))
def on_button1_callback(): global angerValue if angerValue > random.randint(3, 5): angerValue = 0 time.sleep(0.2) codey.face('00003c1e0e0400000000040e1e3c0000') rocky.back(50) time.sleep(0.4) codey.say('dog.wav') codey.face('00007c3e1e0e040000040e1e3e7c0000') rocky.back(100) time.sleep(0.05) rocky.forward(100) time.sleep(0.5) rocky.back(100) time.sleep(0.01) rocky.stop() time.sleep(0.2) else: codey.say('happy.wav') codey.face('000c18181c0c000000000c1c18180c00') time.sleep(0.3) rocky.left(70) time.sleep(0.05) codey.face('00183030381800000000183830301800') rocky.right(70) time.sleep(0.05) rocky.left(70) time.sleep(0.05) rocky.right(70) time.sleep(0.05) rocky.stop() codey.face('000c18181c0c000000000c1c18180c00') time.sleep(0.3) codey.face('00183030381800000000183830301800') time.sleep(0.1) codey.face('00003c7e7e3c000000003c7e7e3c0000') angerValue = (angerValue if isinstance(angerValue, int) or isinstance(angerValue, float) else 0) + 1 codey.message(str('hello'))