codey.show(iot.weather('2164425', '0'))
    codey.color('#ffffff')
    time.sleep(2)
    while True:
        time.sleep(1)
        codey.show(codey.wifi_is_connected())
        if codey.wifi_is_connected():
            codey.say('step2.wav', True)
            codey.color('#00ff50')

        else:
            codey.color('#ff0000')


codey.on_button('C', on_button_callback)


def on_button1_callback():
    global a
    codey.say('wake.wav', True)
    codey.show(2)


codey.on_button('A', on_button1_callback)


def on_button2_callback():
    global a
    codey.color('#ff0000', 1)
Esempio n. 2
0
            plane_run(plane_cur_pos, plane_last_pos)
            plane_last_pos = plane_cur_pos
            if codey.is_button("C"):
                shoot()
            if t_count >= 10:
                barrier_control()
                t_count = 0
            t_count += 1
            time.sleep(0.020)


def button_a_cb():
    global plane_cur_pos
    global plane_last_pos
    plane_cur_pos -= 1
    if plane_cur_pos < 0:
        plane_cur_pos = 0


def button_b_cb():
    global plane_cur_pos
    global plane_last_pos
    plane_cur_pos += 1
    if plane_cur_pos > 13:
        plane_cur_pos = 13


codey.on_button("A", button_a_cb)
codey.on_button("B", button_b_cb)

plane_contril()
Esempio n. 3
0
import codey
import random

x = 0
list = []

def on_button_callback():
    global x
    x = random.randint(1, 36)
    if  x in list:
        x = random.randint(1, 36)

    else:
        codey.show(x)
        codey.say('score.wav')
        list.append(x)

codey.on_button('A', on_button_callback)



if codey.is_shaked():
    while not not True:





Esempio n. 4
0
a = sprite_create("00000000000000000000000000303000")
game.add_sprite(b)
game.add_sprite(a)

cur_direc = 1  # 1: right-up 2: right-down 3: left-up 4: left-down
last_direc = 1
speed = 1
b.up()


def on_button_callback():
    global cur_direc, last_direc
    b.left()


codey.on_button('A', on_button_callback)


def on_button_callback1():
    global cur_direc, last_direc
    b.right()


codey.on_button('B', on_button_callback1)


def on_button_callback2():
    global cur_direc, last_direc
    count = 0
    while True:
        speed = codey.dail() // 10
Esempio n. 5
0
print("***codey APIS all succeed***")
# about rocky
rocky.color("#334455")
rocky.forward(50, 1)
rocky.backward(50, 1)
rocky.turn_left(50, 1)
rocky.turn_right(50, )
rocky.forward(50)
rocky.backward(50)
rocky.turn_left(50)
rocky.turn_right(50)
rocky.drive(50, 50)
rocky.turn_left_angle(15)
rocky.turn_right_angle(15)
rocky.stop()

rocky.is_obstacle_ahead()
rocky.is_color('red')
rocky.red()
rocky.green()
rocky.blue()
rocky.reflection_strength()
rocky.light_strength()
rocky.ir_reflection_strength()
rocky.grey()
print("***rocky APIS all succeed***")


codey.on_button('A', call_back) 
Esempio n. 6
0
        while True:
            if count % down_speed == 0:
                current_script.right()
            
            if current_script.meet_border_check() == RIGHT_MEET:
                move_lock_flag = True
                current_script.left()
                codey.say("score")
                break

            if game.background_collision_check(current_script):
                move_lock_flag = True
                current_script.left()
                codey.say("score")
                break

            move_control()

            time.sleep(0.02)
            count += 1
        time.sleep(0.1)
        game.set_background(game.get_screen())
        current_script.hide()
        time.sleep(0.1)
        line_remove_process()
        game.del_sprite(current_script)
        move_lock_flag = False

codey.on_button('C', on_button_callback3)