Table of Contents

Controllers & Competition

This section documents the classes related to VEX controller input, competition state, and event handling.


Controller

vex.Controller

Controller class - create a class to access the controller
Arguments:
None
Returns:
An instance of the Controller class
Examples:
Source code in vex.py
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
class Controller:
    '''### Controller class - create a class to access the controller

    #### Arguments:
        None

    #### Returns:
        An instance of the Controller class

    #### Examples:
    '''
    class Axis:
        '''### Axis class

        #### Arguments:
            None

        #### Returns:
            An instance of an Axis class

        #### Examples:
        '''
        def __init__(self, *args):
            pass

        def value(self):
            '''### Return the current position of the axis

            #### Arguments:
                None

            #### Returns:
                A value in the range +/- 127

            #### Examples:
                a = controller.axis1.position()
            '''
            return 0

        def position(self):
            '''### Return the current position of the axis in percentage

            #### Arguments:
                None

            #### Returns:
                A value in the range +/- 100

            #### Examples:
                a = controller.axis1.position()
            '''
            return 0

        def changed(self, callback: Callable[...,None], arg: tuple=()):
            '''### Register a function to be called when the axis value changes

            #### Arguments:
                callback : A function that will be called when the axis value changes
                arg (optional) : A tuple that is used to pass arguments to the callback function.

            #### Returns:
                An instance of the Event class

            #### Examples:
                def foo():
                    print("axis changed")

                controller.axis1.changed(foo)
            '''
            return Event(callback, arg)

    class Button:
        def __init__(self, *args):
            pass

        def pressing(self):
            '''### Returns whether a button is currently being pressed

            #### Arguments:
                None

            #### Returns:
                True or False
            '''
            return False

        def pressed(self, callback: Callable[...,None], arg: tuple=()):
            '''### Register a function to be called when a button is pressed

            #### Arguments:
                callback : A function that will be called when the button is pressed
                arg (optional) : A tuple that is used to pass arguments to the callback function.

            #### Returns:
                An instance of the Event class

            #### Examples:
                def foo():
                    print("button pressed")

                controller.buttonL1.pressed(foo)
            '''
            return Event(callback, arg)

        def released(self, callback: Callable[...,None], arg: tuple=()):
            '''### Register a function to be called when a button is released

            #### Arguments:
                callback : A function that will be called when the button is released
                arg (optional) : A tuple that is used to pass arguments to the callback function.

            #### Returns:
                An instance of the Event class

            #### Examples:
                def foo():
                    print("button released")

                controller.buttonL1.released(foo)
            '''
            return Event(callback, arg)

    class Lcd:
        '''### Controller.Lcd class

        A class used to access the screen on the V5 controller.

        #### Arguments:
            None

        #### Returns:
            An instance of the Brain.Lcd class
        '''
        def __init__(self, *args):
            self._row = 0
            self._col = 0
            pass

        def set_cursor(self, row: vexnumber, col: vexnumber):
            '''### Set the cursor position used for printing text on the screen

            V5 controller has at most 3 lines of text

            #### Arguments:
                row : The cursor row.  1, 2 or 3
                col : The cursor column.  The first column is 1.

            #### Returns:
                None
            '''
            self._row = row
            self._col = col

        def column(self):
            '''Return the current column where text will be printed'''
            return self._col

        def row(self):
            '''Return the current row where text will be printed'''
            return self._row

        def print(self, *args):
            '''### print text on the screen using current curser position.

            #### Arguments:
                Optional keyword arguments:
                sep : string inserted between values, default a space.
                precision : the number of decimal places to display when printing simple numbers, default is 2

            #### Returns:
                None

            #### Examples:
                # print the number 1 on the screen at current cursor position\\
                controller.screen.print(1)

                # print the numbers 1, 2, 3 and 4 on the screen at current cursor position separated by a '-'\\
                controller.screen.print(1, 2, 3, 4, sep='-')

                # print motor1 velocity on the screen using a format string\\
                controller.screen.print("motor  1 : % 7.2f" %(motor1.velocity()))
            '''
            pass

        def clear_screen(self):
            '''### Clear the whole screen

            #### Arguments:
                None

            #### Returns:
                None

            #### Examples:
                controller.screen.clear_screen()
            '''
            pass

        # deprecated
        def clear_line(self, number: vexnumber):
            pass

        def clear_row(self, number: vexnumber):
            '''### Clear screen row

            #### Arguments:
                row (optional) : The row to clear, 1, 2, or 3, default is current cursor row

            #### Returns:
                None

            #### Examples:
                # clear row 2\\
                controller.screen.clear_row(2)
            '''
            pass

        # deprecated
        def new_line(self):
            pass

        def next_row(self):
            '''### Move the cursor to the beginning of the next row

            #### Arguments:
                None

            #### Returns:
                None
            '''
            pass

    def __init__(self, *args):
        self.axis1 = Controller.Axis()
        '''The joystick axis 1 on the controller'''
        self.axis2 = Controller.Axis()
        '''The joystick axis 2 on the controller'''
        self.axis3 = Controller.Axis()
        '''The joystick axis 3 on the controller'''
        self.axis4 = Controller.Axis()
        '''The joystick axis 4 on the controller'''

        self.buttonL1 = Controller.Button()
        '''The L1 button on the controller'''
        self.buttonL2 = Controller.Button()
        '''The L2 button on the controller'''
        self.buttonR1 = Controller.Button()
        '''The R1 button on the controller'''
        self.buttonR2 = Controller.Button()
        '''The R2 button on the controller'''
        self.buttonUp = Controller.Button()
        '''The Up button on the controller'''
        self.buttonDown = Controller.Button()
        '''The Down button on the controller'''
        self.buttonLeft = Controller.Button()
        '''The Left button on the controller'''
        self.buttonRight = Controller.Button()
        '''The Right button on the controller'''
        self.buttonA = Controller.Button()
        '''The A button on the controller'''
        self.buttonB = Controller.Button()
        '''The B button on the controller'''
        self.buttonX = Controller.Button()
        '''The X button on the controller'''
        self.buttonY = Controller.Button()
        '''The Y button on the controller'''

        self.screen = Controller.Lcd()
        ''' An instance of the Lcd class'''

    def rumble(self, pattern: str):
        '''### Send a rumble string to the V5 controller

        #### Arguments:
            pattern : A pattern using '.' and '-' for short and long rumbles.

        #### Returns:
            None

        #### Examples:
            controller.rumble('..--')
        '''
        return 0

axis1 = Controller.Axis()

The joystick axis 1 on the controller

axis2 = Controller.Axis()

The joystick axis 2 on the controller

axis3 = Controller.Axis()

The joystick axis 3 on the controller

axis4 = Controller.Axis()

The joystick axis 4 on the controller

buttonA = Controller.Button()

The A button on the controller

buttonB = Controller.Button()

The B button on the controller

buttonDown = Controller.Button()

The Down button on the controller

buttonL1 = Controller.Button()

The L1 button on the controller

buttonL2 = Controller.Button()

The L2 button on the controller

buttonLeft = Controller.Button()

The Left button on the controller

buttonR1 = Controller.Button()

The R1 button on the controller

buttonR2 = Controller.Button()

The R2 button on the controller

buttonRight = Controller.Button()

The Right button on the controller

buttonUp = Controller.Button()

The Up button on the controller

buttonX = Controller.Button()

The X button on the controller

buttonY = Controller.Button()

The Y button on the controller

screen = Controller.Lcd()

An instance of the Lcd class

Axis

Axis class
Arguments:
None
Returns:
An instance of an Axis class
Examples:
Source code in vex.py
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
class Axis:
    '''### Axis class

    #### Arguments:
        None

    #### Returns:
        An instance of an Axis class

    #### Examples:
    '''
    def __init__(self, *args):
        pass

    def value(self):
        '''### Return the current position of the axis

        #### Arguments:
            None

        #### Returns:
            A value in the range +/- 127

        #### Examples:
            a = controller.axis1.position()
        '''
        return 0

    def position(self):
        '''### Return the current position of the axis in percentage

        #### Arguments:
            None

        #### Returns:
            A value in the range +/- 100

        #### Examples:
            a = controller.axis1.position()
        '''
        return 0

    def changed(self, callback: Callable[...,None], arg: tuple=()):
        '''### Register a function to be called when the axis value changes

        #### Arguments:
            callback : A function that will be called when the axis value changes
            arg (optional) : A tuple that is used to pass arguments to the callback function.

        #### Returns:
            An instance of the Event class

        #### Examples:
            def foo():
                print("axis changed")

            controller.axis1.changed(foo)
        '''
        return Event(callback, arg)

changed(callback, arg=())

Register a function to be called when the axis value changes
Arguments:
callback : A function that will be called when the axis value changes
arg (optional) : A tuple that is used to pass arguments to the callback function.
Returns:
An instance of the Event class
Examples:
def foo():
    print("axis changed")

controller.axis1.changed(foo)
Source code in vex.py
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
def changed(self, callback: Callable[...,None], arg: tuple=()):
    '''### Register a function to be called when the axis value changes

    #### Arguments:
        callback : A function that will be called when the axis value changes
        arg (optional) : A tuple that is used to pass arguments to the callback function.

    #### Returns:
        An instance of the Event class

    #### Examples:
        def foo():
            print("axis changed")

        controller.axis1.changed(foo)
    '''
    return Event(callback, arg)

position()

Return the current position of the axis in percentage
Arguments:
None
Returns:
A value in the range +/- 100
Examples:
a = controller.axis1.position()
Source code in vex.py
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
def position(self):
    '''### Return the current position of the axis in percentage

    #### Arguments:
        None

    #### Returns:
        A value in the range +/- 100

    #### Examples:
        a = controller.axis1.position()
    '''
    return 0

value()

Return the current position of the axis
Arguments:
None
Returns:
A value in the range +/- 127
Examples:
a = controller.axis1.position()
Source code in vex.py
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
def value(self):
    '''### Return the current position of the axis

    #### Arguments:
        None

    #### Returns:
        A value in the range +/- 127

    #### Examples:
        a = controller.axis1.position()
    '''
    return 0

Button

Source code in vex.py
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
class Button:
    def __init__(self, *args):
        pass

    def pressing(self):
        '''### Returns whether a button is currently being pressed

        #### Arguments:
            None

        #### Returns:
            True or False
        '''
        return False

    def pressed(self, callback: Callable[...,None], arg: tuple=()):
        '''### Register a function to be called when a button is pressed

        #### Arguments:
            callback : A function that will be called when the button is pressed
            arg (optional) : A tuple that is used to pass arguments to the callback function.

        #### Returns:
            An instance of the Event class

        #### Examples:
            def foo():
                print("button pressed")

            controller.buttonL1.pressed(foo)
        '''
        return Event(callback, arg)

    def released(self, callback: Callable[...,None], arg: tuple=()):
        '''### Register a function to be called when a button is released

        #### Arguments:
            callback : A function that will be called when the button is released
            arg (optional) : A tuple that is used to pass arguments to the callback function.

        #### Returns:
            An instance of the Event class

        #### Examples:
            def foo():
                print("button released")

            controller.buttonL1.released(foo)
        '''
        return Event(callback, arg)

pressed(callback, arg=())

Register a function to be called when a button is pressed
Arguments:
callback : A function that will be called when the button is pressed
arg (optional) : A tuple that is used to pass arguments to the callback function.
Returns:
An instance of the Event class
Examples:
def foo():
    print("button pressed")

controller.buttonL1.pressed(foo)
Source code in vex.py
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
def pressed(self, callback: Callable[...,None], arg: tuple=()):
    '''### Register a function to be called when a button is pressed

    #### Arguments:
        callback : A function that will be called when the button is pressed
        arg (optional) : A tuple that is used to pass arguments to the callback function.

    #### Returns:
        An instance of the Event class

    #### Examples:
        def foo():
            print("button pressed")

        controller.buttonL1.pressed(foo)
    '''
    return Event(callback, arg)

pressing()

Returns whether a button is currently being pressed
Arguments:
None
Returns:
True or False
Source code in vex.py
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
def pressing(self):
    '''### Returns whether a button is currently being pressed

    #### Arguments:
        None

    #### Returns:
        True or False
    '''
    return False

released(callback, arg=())

Register a function to be called when a button is released
Arguments:
callback : A function that will be called when the button is released
arg (optional) : A tuple that is used to pass arguments to the callback function.
Returns:
An instance of the Event class
Examples:
def foo():
    print("button released")

controller.buttonL1.released(foo)
Source code in vex.py
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
def released(self, callback: Callable[...,None], arg: tuple=()):
    '''### Register a function to be called when a button is released

    #### Arguments:
        callback : A function that will be called when the button is released
        arg (optional) : A tuple that is used to pass arguments to the callback function.

    #### Returns:
        An instance of the Event class

    #### Examples:
        def foo():
            print("button released")

        controller.buttonL1.released(foo)
    '''
    return Event(callback, arg)

Lcd

Controller.Lcd class

A class used to access the screen on the V5 controller.

Arguments:
None
Returns:
An instance of the Brain.Lcd class
Source code in vex.py
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
class Lcd:
    '''### Controller.Lcd class

    A class used to access the screen on the V5 controller.

    #### Arguments:
        None

    #### Returns:
        An instance of the Brain.Lcd class
    '''
    def __init__(self, *args):
        self._row = 0
        self._col = 0
        pass

    def set_cursor(self, row: vexnumber, col: vexnumber):
        '''### Set the cursor position used for printing text on the screen

        V5 controller has at most 3 lines of text

        #### Arguments:
            row : The cursor row.  1, 2 or 3
            col : The cursor column.  The first column is 1.

        #### Returns:
            None
        '''
        self._row = row
        self._col = col

    def column(self):
        '''Return the current column where text will be printed'''
        return self._col

    def row(self):
        '''Return the current row where text will be printed'''
        return self._row

    def print(self, *args):
        '''### print text on the screen using current curser position.

        #### Arguments:
            Optional keyword arguments:
            sep : string inserted between values, default a space.
            precision : the number of decimal places to display when printing simple numbers, default is 2

        #### Returns:
            None

        #### Examples:
            # print the number 1 on the screen at current cursor position\\
            controller.screen.print(1)

            # print the numbers 1, 2, 3 and 4 on the screen at current cursor position separated by a '-'\\
            controller.screen.print(1, 2, 3, 4, sep='-')

            # print motor1 velocity on the screen using a format string\\
            controller.screen.print("motor  1 : % 7.2f" %(motor1.velocity()))
        '''
        pass

    def clear_screen(self):
        '''### Clear the whole screen

        #### Arguments:
            None

        #### Returns:
            None

        #### Examples:
            controller.screen.clear_screen()
        '''
        pass

    # deprecated
    def clear_line(self, number: vexnumber):
        pass

    def clear_row(self, number: vexnumber):
        '''### Clear screen row

        #### Arguments:
            row (optional) : The row to clear, 1, 2, or 3, default is current cursor row

        #### Returns:
            None

        #### Examples:
            # clear row 2\\
            controller.screen.clear_row(2)
        '''
        pass

    # deprecated
    def new_line(self):
        pass

    def next_row(self):
        '''### Move the cursor to the beginning of the next row

        #### Arguments:
            None

        #### Returns:
            None
        '''
        pass

clear_row(number)

Clear screen row
Arguments:
row (optional) : The row to clear, 1, 2, or 3, default is current cursor row
Returns:
None
Examples:
# clear row 2\
controller.screen.clear_row(2)
Source code in vex.py
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
def clear_row(self, number: vexnumber):
    '''### Clear screen row

    #### Arguments:
        row (optional) : The row to clear, 1, 2, or 3, default is current cursor row

    #### Returns:
        None

    #### Examples:
        # clear row 2\\
        controller.screen.clear_row(2)
    '''
    pass

clear_screen()

Clear the whole screen
Arguments:
None
Returns:
None
Examples:
controller.screen.clear_screen()
Source code in vex.py
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
def clear_screen(self):
    '''### Clear the whole screen

    #### Arguments:
        None

    #### Returns:
        None

    #### Examples:
        controller.screen.clear_screen()
    '''
    pass

column()

Return the current column where text will be printed

Source code in vex.py
1594
1595
1596
def column(self):
    '''Return the current column where text will be printed'''
    return self._col

next_row()

Move the cursor to the beginning of the next row
Arguments:
None
Returns:
None
Source code in vex.py
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
def next_row(self):
    '''### Move the cursor to the beginning of the next row

    #### Arguments:
        None

    #### Returns:
        None
    '''
    pass

print(*args)

print text on the screen using current curser position.
Arguments:
Optional keyword arguments:
sep : string inserted between values, default a space.
precision : the number of decimal places to display when printing simple numbers, default is 2
Returns:
None
Examples:
# print the number 1 on the screen at current cursor position\
controller.screen.print(1)

# print the numbers 1, 2, 3 and 4 on the screen at current cursor position separated by a '-'\
controller.screen.print(1, 2, 3, 4, sep='-')

# print motor1 velocity on the screen using a format string\
controller.screen.print("motor  1 : % 7.2f" %(motor1.velocity()))
Source code in vex.py
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
def print(self, *args):
    '''### print text on the screen using current curser position.

    #### Arguments:
        Optional keyword arguments:
        sep : string inserted between values, default a space.
        precision : the number of decimal places to display when printing simple numbers, default is 2

    #### Returns:
        None

    #### Examples:
        # print the number 1 on the screen at current cursor position\\
        controller.screen.print(1)

        # print the numbers 1, 2, 3 and 4 on the screen at current cursor position separated by a '-'\\
        controller.screen.print(1, 2, 3, 4, sep='-')

        # print motor1 velocity on the screen using a format string\\
        controller.screen.print("motor  1 : % 7.2f" %(motor1.velocity()))
    '''
    pass

row()

Return the current row where text will be printed

Source code in vex.py
1598
1599
1600
def row(self):
    '''Return the current row where text will be printed'''
    return self._row

set_cursor(row, col)

Set the cursor position used for printing text on the screen

V5 controller has at most 3 lines of text

Arguments:
row : The cursor row.  1, 2 or 3
col : The cursor column.  The first column is 1.
Returns:
None
Source code in vex.py
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
def set_cursor(self, row: vexnumber, col: vexnumber):
    '''### Set the cursor position used for printing text on the screen

    V5 controller has at most 3 lines of text

    #### Arguments:
        row : The cursor row.  1, 2 or 3
        col : The cursor column.  The first column is 1.

    #### Returns:
        None
    '''
    self._row = row
    self._col = col

rumble(pattern)

Send a rumble string to the V5 controller
Arguments:
pattern : A pattern using '.' and '-' for short and long rumbles.
Returns:
None
Examples:
controller.rumble('..--')
Source code in vex.py
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
def rumble(self, pattern: str):
    '''### Send a rumble string to the V5 controller

    #### Arguments:
        pattern : A pattern using '.' and '-' for short and long rumbles.

    #### Returns:
        None

    #### Examples:
        controller.rumble('..--')
    '''
    return 0

Controller.Axis

vex.Controller.Axis

Axis class
Arguments:
None
Returns:
An instance of an Axis class
Examples:
Source code in vex.py
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
class Axis:
    '''### Axis class

    #### Arguments:
        None

    #### Returns:
        An instance of an Axis class

    #### Examples:
    '''
    def __init__(self, *args):
        pass

    def value(self):
        '''### Return the current position of the axis

        #### Arguments:
            None

        #### Returns:
            A value in the range +/- 127

        #### Examples:
            a = controller.axis1.position()
        '''
        return 0

    def position(self):
        '''### Return the current position of the axis in percentage

        #### Arguments:
            None

        #### Returns:
            A value in the range +/- 100

        #### Examples:
            a = controller.axis1.position()
        '''
        return 0

    def changed(self, callback: Callable[...,None], arg: tuple=()):
        '''### Register a function to be called when the axis value changes

        #### Arguments:
            callback : A function that will be called when the axis value changes
            arg (optional) : A tuple that is used to pass arguments to the callback function.

        #### Returns:
            An instance of the Event class

        #### Examples:
            def foo():
                print("axis changed")

            controller.axis1.changed(foo)
        '''
        return Event(callback, arg)

changed(callback, arg=())

Register a function to be called when the axis value changes
Arguments:
callback : A function that will be called when the axis value changes
arg (optional) : A tuple that is used to pass arguments to the callback function.
Returns:
An instance of the Event class
Examples:
def foo():
    print("axis changed")

controller.axis1.changed(foo)
Source code in vex.py
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
def changed(self, callback: Callable[...,None], arg: tuple=()):
    '''### Register a function to be called when the axis value changes

    #### Arguments:
        callback : A function that will be called when the axis value changes
        arg (optional) : A tuple that is used to pass arguments to the callback function.

    #### Returns:
        An instance of the Event class

    #### Examples:
        def foo():
            print("axis changed")

        controller.axis1.changed(foo)
    '''
    return Event(callback, arg)

position()

Return the current position of the axis in percentage
Arguments:
None
Returns:
A value in the range +/- 100
Examples:
a = controller.axis1.position()
Source code in vex.py
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
def position(self):
    '''### Return the current position of the axis in percentage

    #### Arguments:
        None

    #### Returns:
        A value in the range +/- 100

    #### Examples:
        a = controller.axis1.position()
    '''
    return 0

value()

Return the current position of the axis
Arguments:
None
Returns:
A value in the range +/- 127
Examples:
a = controller.axis1.position()
Source code in vex.py
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
def value(self):
    '''### Return the current position of the axis

    #### Arguments:
        None

    #### Returns:
        A value in the range +/- 127

    #### Examples:
        a = controller.axis1.position()
    '''
    return 0

Controller.Button

vex.Controller.Button

Source code in vex.py
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
class Button:
    def __init__(self, *args):
        pass

    def pressing(self):
        '''### Returns whether a button is currently being pressed

        #### Arguments:
            None

        #### Returns:
            True or False
        '''
        return False

    def pressed(self, callback: Callable[...,None], arg: tuple=()):
        '''### Register a function to be called when a button is pressed

        #### Arguments:
            callback : A function that will be called when the button is pressed
            arg (optional) : A tuple that is used to pass arguments to the callback function.

        #### Returns:
            An instance of the Event class

        #### Examples:
            def foo():
                print("button pressed")

            controller.buttonL1.pressed(foo)
        '''
        return Event(callback, arg)

    def released(self, callback: Callable[...,None], arg: tuple=()):
        '''### Register a function to be called when a button is released

        #### Arguments:
            callback : A function that will be called when the button is released
            arg (optional) : A tuple that is used to pass arguments to the callback function.

        #### Returns:
            An instance of the Event class

        #### Examples:
            def foo():
                print("button released")

            controller.buttonL1.released(foo)
        '''
        return Event(callback, arg)

pressed(callback, arg=())

Register a function to be called when a button is pressed
Arguments:
callback : A function that will be called when the button is pressed
arg (optional) : A tuple that is used to pass arguments to the callback function.
Returns:
An instance of the Event class
Examples:
def foo():
    print("button pressed")

controller.buttonL1.pressed(foo)
Source code in vex.py
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
def pressed(self, callback: Callable[...,None], arg: tuple=()):
    '''### Register a function to be called when a button is pressed

    #### Arguments:
        callback : A function that will be called when the button is pressed
        arg (optional) : A tuple that is used to pass arguments to the callback function.

    #### Returns:
        An instance of the Event class

    #### Examples:
        def foo():
            print("button pressed")

        controller.buttonL1.pressed(foo)
    '''
    return Event(callback, arg)

pressing()

Returns whether a button is currently being pressed
Arguments:
None
Returns:
True or False
Source code in vex.py
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
def pressing(self):
    '''### Returns whether a button is currently being pressed

    #### Arguments:
        None

    #### Returns:
        True or False
    '''
    return False

released(callback, arg=())

Register a function to be called when a button is released
Arguments:
callback : A function that will be called when the button is released
arg (optional) : A tuple that is used to pass arguments to the callback function.
Returns:
An instance of the Event class
Examples:
def foo():
    print("button released")

controller.buttonL1.released(foo)
Source code in vex.py
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
def released(self, callback: Callable[...,None], arg: tuple=()):
    '''### Register a function to be called when a button is released

    #### Arguments:
        callback : A function that will be called when the button is released
        arg (optional) : A tuple that is used to pass arguments to the callback function.

    #### Returns:
        An instance of the Event class

    #### Examples:
        def foo():
            print("button released")

        controller.buttonL1.released(foo)
    '''
    return Event(callback, arg)

Controller.Lcd

vex.Controller.Lcd

Controller.Lcd class

A class used to access the screen on the V5 controller.

Arguments:
None
Returns:
An instance of the Brain.Lcd class
Source code in vex.py
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
class Lcd:
    '''### Controller.Lcd class

    A class used to access the screen on the V5 controller.

    #### Arguments:
        None

    #### Returns:
        An instance of the Brain.Lcd class
    '''
    def __init__(self, *args):
        self._row = 0
        self._col = 0
        pass

    def set_cursor(self, row: vexnumber, col: vexnumber):
        '''### Set the cursor position used for printing text on the screen

        V5 controller has at most 3 lines of text

        #### Arguments:
            row : The cursor row.  1, 2 or 3
            col : The cursor column.  The first column is 1.

        #### Returns:
            None
        '''
        self._row = row
        self._col = col

    def column(self):
        '''Return the current column where text will be printed'''
        return self._col

    def row(self):
        '''Return the current row where text will be printed'''
        return self._row

    def print(self, *args):
        '''### print text on the screen using current curser position.

        #### Arguments:
            Optional keyword arguments:
            sep : string inserted between values, default a space.
            precision : the number of decimal places to display when printing simple numbers, default is 2

        #### Returns:
            None

        #### Examples:
            # print the number 1 on the screen at current cursor position\\
            controller.screen.print(1)

            # print the numbers 1, 2, 3 and 4 on the screen at current cursor position separated by a '-'\\
            controller.screen.print(1, 2, 3, 4, sep='-')

            # print motor1 velocity on the screen using a format string\\
            controller.screen.print("motor  1 : % 7.2f" %(motor1.velocity()))
        '''
        pass

    def clear_screen(self):
        '''### Clear the whole screen

        #### Arguments:
            None

        #### Returns:
            None

        #### Examples:
            controller.screen.clear_screen()
        '''
        pass

    # deprecated
    def clear_line(self, number: vexnumber):
        pass

    def clear_row(self, number: vexnumber):
        '''### Clear screen row

        #### Arguments:
            row (optional) : The row to clear, 1, 2, or 3, default is current cursor row

        #### Returns:
            None

        #### Examples:
            # clear row 2\\
            controller.screen.clear_row(2)
        '''
        pass

    # deprecated
    def new_line(self):
        pass

    def next_row(self):
        '''### Move the cursor to the beginning of the next row

        #### Arguments:
            None

        #### Returns:
            None
        '''
        pass

clear_row(number)

Clear screen row
Arguments:
row (optional) : The row to clear, 1, 2, or 3, default is current cursor row
Returns:
None
Examples:
# clear row 2\
controller.screen.clear_row(2)
Source code in vex.py
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
def clear_row(self, number: vexnumber):
    '''### Clear screen row

    #### Arguments:
        row (optional) : The row to clear, 1, 2, or 3, default is current cursor row

    #### Returns:
        None

    #### Examples:
        # clear row 2\\
        controller.screen.clear_row(2)
    '''
    pass

clear_screen()

Clear the whole screen
Arguments:
None
Returns:
None
Examples:
controller.screen.clear_screen()
Source code in vex.py
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
def clear_screen(self):
    '''### Clear the whole screen

    #### Arguments:
        None

    #### Returns:
        None

    #### Examples:
        controller.screen.clear_screen()
    '''
    pass

column()

Return the current column where text will be printed

Source code in vex.py
1594
1595
1596
def column(self):
    '''Return the current column where text will be printed'''
    return self._col

next_row()

Move the cursor to the beginning of the next row
Arguments:
None
Returns:
None
Source code in vex.py
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
def next_row(self):
    '''### Move the cursor to the beginning of the next row

    #### Arguments:
        None

    #### Returns:
        None
    '''
    pass

print(*args)

print text on the screen using current curser position.
Arguments:
Optional keyword arguments:
sep : string inserted between values, default a space.
precision : the number of decimal places to display when printing simple numbers, default is 2
Returns:
None
Examples:
# print the number 1 on the screen at current cursor position\
controller.screen.print(1)

# print the numbers 1, 2, 3 and 4 on the screen at current cursor position separated by a '-'\
controller.screen.print(1, 2, 3, 4, sep='-')

# print motor1 velocity on the screen using a format string\
controller.screen.print("motor  1 : % 7.2f" %(motor1.velocity()))
Source code in vex.py
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
def print(self, *args):
    '''### print text on the screen using current curser position.

    #### Arguments:
        Optional keyword arguments:
        sep : string inserted between values, default a space.
        precision : the number of decimal places to display when printing simple numbers, default is 2

    #### Returns:
        None

    #### Examples:
        # print the number 1 on the screen at current cursor position\\
        controller.screen.print(1)

        # print the numbers 1, 2, 3 and 4 on the screen at current cursor position separated by a '-'\\
        controller.screen.print(1, 2, 3, 4, sep='-')

        # print motor1 velocity on the screen using a format string\\
        controller.screen.print("motor  1 : % 7.2f" %(motor1.velocity()))
    '''
    pass

row()

Return the current row where text will be printed

Source code in vex.py
1598
1599
1600
def row(self):
    '''Return the current row where text will be printed'''
    return self._row

set_cursor(row, col)

Set the cursor position used for printing text on the screen

V5 controller has at most 3 lines of text

Arguments:
row : The cursor row.  1, 2 or 3
col : The cursor column.  The first column is 1.
Returns:
None
Source code in vex.py
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
def set_cursor(self, row: vexnumber, col: vexnumber):
    '''### Set the cursor position used for printing text on the screen

    V5 controller has at most 3 lines of text

    #### Arguments:
        row : The cursor row.  1, 2 or 3
        col : The cursor column.  The first column is 1.

    #### Returns:
        None
    '''
    self._row = row
    self._col = col

Competition

vex.Competition

Competition class - create a class used for competition control
Arguments:
driver : A function called as a thread when the driver control period starts.
autonomous : A function called as a thread when the driver control period starts.
Returns:
An instance of the Competition class
Examples:
def driver():
    print("driver called")

def auton():
    print("auton called")

comp = Competition(driver, auton)
Source code in vex.py
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
class Competition:
    '''### Competition class - create a class used for competition control

    #### Arguments:
        driver : A function called as a thread when the driver control period starts.
        autonomous : A function called as a thread when the driver control period starts.

    #### Returns:
        An instance of the Competition class

    #### Examples:
        def driver():
            print("driver called")

        def auton():
            print("auton called")

        comp = Competition(driver, auton)
    '''
    def __init__(self, driver: Callable[[],None], autonomous: Callable[[],None]):
        self._driver_cb = driver
        self._auton_cb = autonomous

        self._driver_thread = None
        self._auton_thread = None

    @staticmethod
    def is_enabled():
        '''### return enable/disable state of the robot

        #### Arguments:
            None

        #### Returns:
            True if the robot is enabled
        '''
        return True

    @staticmethod
    def is_driver_control():
        '''### return driver control state of the robot

        #### Arguments:
            None

        #### Returns:
            True if driver control is enabled
        '''
        return True

    def is_autonomous(self=None):
        '''### return autonomous state of the robot

        #### Arguments:
            None

        #### Returns:
            True if autonomous is enabled
        '''
        return False

    def is_competition_switch(self=None):
        '''### return connection state of the competition switch

        #### Arguments:
            None

        #### Returns:
            True if competition switch is connected
        '''
        return True

    def is_field_control(self=None):
        '''### return connection state of field controller

        #### Arguments:
            None

        #### Returns:
            True if field controller is connected
        '''
        return False

is_autonomous()

return autonomous state of the robot
Arguments:
None
Returns:
True if autonomous is enabled
Source code in vex.py
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
def is_autonomous(self=None):
    '''### return autonomous state of the robot

    #### Arguments:
        None

    #### Returns:
        True if autonomous is enabled
    '''
    return False

is_competition_switch()

return connection state of the competition switch
Arguments:
None
Returns:
True if competition switch is connected
Source code in vex.py
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
def is_competition_switch(self=None):
    '''### return connection state of the competition switch

    #### Arguments:
        None

    #### Returns:
        True if competition switch is connected
    '''
    return True

is_driver_control()

return driver control state of the robot
Arguments:
None
Returns:
True if driver control is enabled
Source code in vex.py
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
@staticmethod
def is_driver_control():
    '''### return driver control state of the robot

    #### Arguments:
        None

    #### Returns:
        True if driver control is enabled
    '''
    return True

is_enabled()

return enable/disable state of the robot
Arguments:
None
Returns:
True if the robot is enabled
Source code in vex.py
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
@staticmethod
def is_enabled():
    '''### return enable/disable state of the robot

    #### Arguments:
        None

    #### Returns:
        True if the robot is enabled
    '''
    return True

is_field_control()

return connection state of field controller
Arguments:
None
Returns:
True if field controller is connected
Source code in vex.py
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
def is_field_control(self=None):
    '''### return connection state of field controller

    #### Arguments:
        None

    #### Returns:
        True if field controller is connected
    '''
    return False

Event

vex.Event

Event class - create a new event

A function is registered that will be called when the event broadcast() function is called. More than one function can be assigned to a single event.

Arguments:
callback (optional) : A function that will be called when the event is broadcast.
arg (optional) : A tuple that is used to pass arguments to the event callback function.
Returns:
An instance of the Event class
Examples:
def foo():
    print("foo")

def bar():
    print("bar")

e = Event(foo)\
e.set(bar)

# There needs to be some small delay after events are created before they can be broadcast to\
sleep(20)

# cause both foo and bar to be called\
e.broadcast()
Source code in vex.py
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
class Event:
    '''### Event class - create a new event

    A function is registered that will be called when the event broadcast() function is called.
    More than one function can be assigned to a single event.

    #### Arguments:
        callback (optional) : A function that will be called when the event is broadcast.
        arg (optional) : A tuple that is used to pass arguments to the event callback function.

    #### Returns:
        An instance of the Event class

    #### Examples:
        def foo():
            print("foo")

        def bar():
            print("bar")

        e = Event(foo)\\
        e.set(bar)

        # There needs to be some small delay after events are created before they can be broadcast to\\
        sleep(20)

        # cause both foo and bar to be called\\
        e.broadcast()
    '''
    def __init__(self, callback=None, arg: tuple=()):
        pass

    def __call__(self, callback: Callable[...,None], arg: tuple=()):
        '''### Add callback function to an existing event

        #### Arguments:
            callback : A function that will be called when the event is broadcast.
            arg (optional) : A tuple that is used to pass arguments to the event callback function.

        #### Returns:
            None

        #### Examples:
            def bar():
                print("bar")

            # add callback function to existing event e\\
            e(bar)
        '''
        pass

    def set(self, callback: Callable[...,None], arg: tuple=()):
        '''### Add callback function to an existing event

        #### Arguments:
            callback : A function that will be called when the event is broadcast.
            arg (optional) : A tuple that is used to pass arguments to the event callback function.

        #### Returns:
            None

        #### Examples:
            def bar():
                print("bar")

            # add callback function to existing event e\\
            e.set(bar)
        '''
        pass

    def broadcast(self):
        '''### Broadcast to the event and cause all registered callback function to run

        #### Arguments:
            None

        #### Returns:
            None

        #### Examples:
            # broadcast to an existing event e\\
            e.broadcast()
        '''
        pass

    def broadcast_and_wait(self, timeout=60000):
        '''### Broadcast to the event and cause all registered callback function to run

        This is similar to broadcast except that it will wait for all registered callbacks to complete before returning.

        #### Arguments:
            None

        #### Returns:
            None

        #### Examples:
            # broadcast to an existing event e, wait for completion\\
            e.broadcast_and_wait()
        '''
        pass

__call__(callback, arg=())

Add callback function to an existing event
Arguments:
callback : A function that will be called when the event is broadcast.
arg (optional) : A tuple that is used to pass arguments to the event callback function.
Returns:
None
Examples:
def bar():
    print("bar")

# add callback function to existing event e\
e(bar)
Source code in vex.py
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
def __call__(self, callback: Callable[...,None], arg: tuple=()):
    '''### Add callback function to an existing event

    #### Arguments:
        callback : A function that will be called when the event is broadcast.
        arg (optional) : A tuple that is used to pass arguments to the event callback function.

    #### Returns:
        None

    #### Examples:
        def bar():
            print("bar")

        # add callback function to existing event e\\
        e(bar)
    '''
    pass

broadcast()

Broadcast to the event and cause all registered callback function to run
Arguments:
None
Returns:
None
Examples:
# broadcast to an existing event e\
e.broadcast()
Source code in vex.py
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
def broadcast(self):
    '''### Broadcast to the event and cause all registered callback function to run

    #### Arguments:
        None

    #### Returns:
        None

    #### Examples:
        # broadcast to an existing event e\\
        e.broadcast()
    '''
    pass

broadcast_and_wait(timeout=60000)

Broadcast to the event and cause all registered callback function to run

This is similar to broadcast except that it will wait for all registered callbacks to complete before returning.

Arguments:
None
Returns:
None
Examples:
# broadcast to an existing event e, wait for completion\
e.broadcast_and_wait()
Source code in vex.py
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
def broadcast_and_wait(self, timeout=60000):
    '''### Broadcast to the event and cause all registered callback function to run

    This is similar to broadcast except that it will wait for all registered callbacks to complete before returning.

    #### Arguments:
        None

    #### Returns:
        None

    #### Examples:
        # broadcast to an existing event e, wait for completion\\
        e.broadcast_and_wait()
    '''
    pass

set(callback, arg=())

Add callback function to an existing event
Arguments:
callback : A function that will be called when the event is broadcast.
arg (optional) : A tuple that is used to pass arguments to the event callback function.
Returns:
None
Examples:
def bar():
    print("bar")

# add callback function to existing event e\
e.set(bar)
Source code in vex.py
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
def set(self, callback: Callable[...,None], arg: tuple=()):
    '''### Add callback function to an existing event

    #### Arguments:
        callback : A function that will be called when the event is broadcast.
        arg (optional) : A tuple that is used to pass arguments to the event callback function.

    #### Returns:
        None

    #### Examples:
        def bar():
            print("bar")

        # add callback function to existing event e\\
        e.set(bar)
    '''
    pass