Пример #1
0
def rgb_test():
    print("red on")
    codey.color("#ff0000", 1)
    print("green on")
    codey.color("#00ff00", 1)
    print("blue on")
    codey.color("#0000ff", 1)
    print("single red on")
    codey.red(255)
    time.sleep(1)
    print("single green on")
    codey.green(255)
    time.sleep(1)
    print("single blue on")
    codey.blue(255)
    time.sleep(1)
    print("single red off")
    codey.red(0)
    time.sleep(1) 
    print("single green off")
    codey.green(0)
    time.sleep(1)
    print("single blue off")
    codey.blue(0)       
    time.sleep(1)
Пример #2
0
def on_button2_callback():
    global current_backgroup
    global note_play_index
    global update_row_num
    global user_score
    if game_status != GAME_PLAYING:
        pass
    else:
        index = update_row_num // 3 - 2
        print('C index is', index)
        if current_backgroup[NOTE_MIDDLE_COLUMN] & 0x01:
            codey.green(50)
            user_score += 1
            codey.play_note(note_table[index][0], note_table[index][1])
Пример #3
0
    while True:
        sensor_test() 

# about codey
codey.face('00001020402012020212204020100000', 1)
codey.face('00001020402012020212204020100000')
codey.show('hello world')
codey.clear()
codey.pixel(0, 0)
codey.pixel_off(0, 0)
codey.pixel_toggle(0, 0)
codey.color('#334455', 1)
codey.color('#334455')
codey.color_off()
codey.red(255)
codey.green(255)
codey.blue(0)
codey.say('cat') 
codey.say('cat.wav')
codey.say('cat', True)
codey.mute()
codey.play_note(50, 1)
codey.pause(0.25)
codey.play_freq(700, 1)
codey.change_volume(-10)
codey.set_volume(100)
codey.get_volume()
codey.message("a")
codey.is_button('A')
codey.is_shaked()
codey.is_tilt('forward')