rcute_cozmars.cube

class rcute_cozmars.cube.AioCube(serial_or_ip=None)

Asynchronous (async/await) mode of Cube

参数:serial_or_ip (str) – The IP address or serial number of the cube to be connected. Default to None, in which case the program will automatically detect the cube on connection if there’s only one found.
last_action = None

The last action of the cube

when_flipped = None

Callback function, called when the cube is flipped (with a parameter to indicate 90 degree flip or 180 degrees), the default is None

when_shaken = None

Callback function, called when the cube is shaken, the default is None

when_rotated = None

Callback function, called when the cube is rotated horizontally (with a parameter indicating clockwise or counterclockwise), the default is None

when_pushed = None

Callback function, called when the cube is translated (with a parameter to indicate the direction of movement), the default is None

when_tilted = None

Callback function, called when the cube is tilted (with a parameter to indicate the direction of movement), the default is None

when_tapped = None

Callback function, called when the cube is tapped, the default is None

when_fall = None

Callback function, called when the cube free fall, the default is None

when_moved = None

Callback function, called when the cube is moved (including all the above actions), the default is None

when_static = None

Callback function, called when the cube comes to rest, the default is None

static dir2num(dir)

Convert direction to number

static num2dir(num)

Convert number to direction

connected
ip

cube’s IP Address

hostname

The URL of the cube

firmware_version

The firmware version of the cube

mac

cube’s MAC Address

serial

Serial Number of cube

acc

Acceleration, when the cube is stationary, the acceleration is equal to gravity (but in fact there is an error)

connect()
disconnect()
led

BGR color of the builtin LED

static

Is it still

top_face

Which side is on top, when the cube is stationary, it returns the direction of the top side, and None cube is moving

class rcute_cozmars.cube.Cube(serial_or_ip=None)

Synchronous mode of Cube

参数:serial_or_ip (str) – The IP address or serial number of the cube to be connected. Default to None, in which case the program will automatically detect the cube on connection if there’s only one found.
acc

Acceleration, when the cube is stationary, the acceleration is equal to gravity (but in fact there is an error)

connected
static dir2num(dir)

Convert direction to number

firmware_version

The firmware version of the cube

hostname

The URL of the cube

ip

cube’s IP Address

led

BGR color of the builtin LED

mac

cube’s MAC Address

static num2dir(num)

Convert number to direction

serial

Serial Number of cube

static

Is it still

top_face

Which side is on top, when the cube is stationary, it returns the direction of the top side, and None cube is moving

connect()
disconnect()
class rcute_cozmars.cube.AsyncCube(serial_or_ip=None)

Asynchronous (concurrent.futures.Future) mode of cube

参数:serial_or_ip (str) – The IP address or serial number of the cube to be connected. Default to None, in which case the program will automatically detect the cube on connection if there’s only one found.
acc

Acceleration, when the cube is stationary, the acceleration is equal to gravity (but in fact there is an error)

connect()
connected
static dir2num(dir)

Convert direction to number

disconnect()
firmware_version

The firmware version of the cube

hostname

The URL of the cube

ip

cube’s IP Address

led

BGR color of the builtin LED

mac

cube’s MAC Address

static num2dir(num)

Convert number to direction

serial

Serial Number of cube

static

Is it still

top_face

Which side is on top, when the cube is stationary, it returns the direction of the top side, and None cube is moving