示例#1
0
games = [
    PressBlinkersGame(c),
    SyncBlinkersGame(c)
]

slots = [
    LCDSlot(c),
]

import sys

if __name__ == '__main__' and len(sys.argv) == 1:
    fc = FutureClient('ws://localhost:8888/socket','VidEditConsole')
    fc.available_games = games
    fc.message_slots = slots
    fc.start()
    while True:
        try:
            time.sleep(0.05)
        except:
            fc.quit()
            break
else:
    # test mode
    for i in range(led_count):
        c.set_led(i,1)
        time.sleep(0.5)
        c.set_led(i,0)
    for i in range(illum_count):
        c.set_illuminated(i,1)
示例#2
0
songs = [  #("ROW YOUR BOAT",   [0, 0, 0, 2, 4]),       # Row Row Row Your Boat - C C C D E
		 ("E-I-E-I-O",       [4, 4, 2, 2, 0]),       # E-I-E-I-O - E E D D C
		 ("FRERE JACQUES",   [7, 9, 11, 7]),         # Frere Jacques - G A B G
		 ("TWINKLE TWINKLE", [7, 7, 2, 2]),          # Twinkle Twinkle Little Star - G G D D 
		 ("ALOUETTE",        [0, 2, 4, 4]),          # Alouette - C D E E 
		 ("BEETHOVEN",       [9, 9, 9, 5]),          # Beethoven's 5th - A A A F
		 #("HAPPY BIRTHDAY",  [2, 2, 4, 2, 7, 5]),    # Happy Birthday - D D E D G F
		]

chords = [  [0, 'MAJOR'],
            [4, 'MAJOR'],
            [9, 'MAJOR'],
            [2, 'MINOR'],
          #  [7, 'MINOR'],
            [5, 'MINOR'] ] 

fc = FutureClient(name="ToyPianoClient", urlstring="ws://192.168.1.99:2600/socket")
fc.available_games = [PlayOneNote(controller, i) for i in controller.allKeys] 
fc.message_slots = [LCDMessageSlot('PrintSlot', controller.lcd)]

fc.start()
try:
	while 1:
		controller.lcd.update()
		time.sleep(0.05)
except:
	fc.quit()


c = Controller()

games = [
    PatchVerbGame(c),
    ToggleSwitchGame(c),
    AllOffGame(c)
]

slots = [
    #StdoutSlot(c),
]

import sys

if __name__ == '__main__' and len(sys.argv) == 1:
    fc = FutureClient('ws://192.168.1.99:2600/socket','PatchConsole')
    #fc = FutureClient('ws://localhost:2600/socket', name='PatchConsole')
    fc.available_games = games
    fc.message_slots = slots
    fc.start()
    try:
	while True:
	    c.get_patches()
	    #time.sleep(0.05)
    except:
	fc.quit()
else:
    # test mode
    # do nothing
    print "test"
    def __init__(self,name,message):
        super(NothingGame, self).__init__(name, message)

    def play_game(self):
        self.update_message(self.id+': message '+next_id())
        if not self.wait(2):
            return
        self.update_message(self.id+': further message '+next_id())
        if not self.wait(2):
            return
        self.finish(1)

games = [
    NothingGame('A','Initial Message A'),
    NothingGame('B','Initial Message B'),
]

if __name__ == '__main__':
    fc = FutureClient(name='basic transmission client',max_games=3)
    fc.available_games = games
    fc.message_slots = []
    fc.start()
    try:
        while True:
            time.sleep(0.05)
    finally:
        fc.quit()