import os import sys from pprint import pprint sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from smartphone_connector import Connector from examples.server_address import SERVER_ADDRESS device = Connector(SERVER_ADDRESS, 'FooBar') device.set_grid([1, 2, 3, 4], base_color='blue') device.sleep(1) device.disconnect()
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from smartphone_connector import Connector from examples.server_address import SERVER_ADDRESS device = Connector(SERVER_ADDRESS, 'FooBar') device.set_grid(""" 99999999999999 99999....99999 99999....99999 99999....99999 99999....99999 9............9 9............9 9............9 9............9 99999....99999 99999....99999 99999....99999 99999....99999 99999999999999 """, base_color='blue', enumerate=True) device.sleep(1) device.set_grid_at(20, 20, 'red') device.sleep(1) device.set_grid(""" 90 09 """, enumerate=True)
import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from smartphone_connector import Connector import numpy as np from examples.server_address import SERVER_ADDRESS device = Connector(SERVER_ADDRESS, 'FooBar') grid1 = np.transpose([[1, 2, 3], [1, 2, 3], [1, 2, 3]]) device.set_grid(grid1, base_color='red' ) assert grid1.tolist() == device.get_grid print('ok') grid2 = np.transpose([[1, 2, 3], [1, 2, 3]]) device.set_grid(grid2, base_color='red' ) assert grid2.tolist() == device.get_grid print('ok2') device.disconnect()
import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from smartphone_connector import Connector from examples.server_address import SERVER_ADDRESS device = Connector(SERVER_ADDRESS, 'FooBar') dimension = 1 device.set_grid([['white']]) while True: for i in range(dimension): device.set_grid_at(i, dimension, 'white' if dimension % 2 == 0 else 'black') device.set_grid_at(dimension, i, 'black' if dimension % 2 == 0 else 'white') device.sleep(0.05) dimension = dimension + 1 if dimension > 50: device.set_grid([['white']]) dimension = 1 device.sleep(1)
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from smartphone_connector import Connector from examples.server_address import SERVER_ADDRESS device = Connector(SERVER_ADDRESS, 'FooBar') device.set_grid(""" 99999999999999 99999....99999 99999....99999 99999....99999 99999....99999 9............9 9............9 9............9 9............9 99999....99999 99999....99999 99999....99999 99999....99999 99999999999999 """, base_color='red') device.sleep(1) pprint(device.get_grid) device.set_grid_at(0, 0, 'red') pprint(device.get_grid) device.set_grid_at(0, 14, 'red') pprint(device.get_grid)