diff --git a/examples/pup/hub_inventorhub/button_main.py b/examples/pup/hub_inventorhub/button_main.py deleted file mode 100644 index c235da3..0000000 --- a/examples/pup/hub_inventorhub/button_main.py +++ /dev/null @@ -1,29 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.parameters import Button, Icon -from pybricks.tools import wait - -# Initialize the hub. -hub = InventorHub() - -# Wait for any button to be pressed, and save the result. -pressed = [] -while not any(pressed): - pressed = hub.buttons.pressed() - wait(10) - -# Display a circle. -hub.display.image(Icon.CIRCLE) - -# Wait for all buttons to be released. -while any(hub.buttons.pressed()): - wait(10) - -# Display an arrow to indicate which button was pressed. -if Button.LEFT in pressed: - hub.display.image(Icon.ARROW_LEFT_DOWN) -elif Button.RIGHT in pressed: - hub.display.image(Icon.ARROW_RIGHT_DOWN) -elif Button.BT in pressed: - hub.display.image(Icon.ARROW_RIGHT_UP) - -wait(3000) diff --git a/examples/pup/hub_inventorhub/display_animate.py b/examples/pup/hub_inventorhub/display_animate.py deleted file mode 100644 index 80004ef..0000000 --- a/examples/pup/hub_inventorhub/display_animate.py +++ /dev/null @@ -1,19 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.parameters import Icon -from pybricks.tools import wait - -# Initialize the hub. -hub = InventorHub() - -# Turn the hub light off (optional). -hub.light.off() - -# Create a list of intensities from 0 to 100 and back. -brightness = list(range(0, 100, 4)) + list(range(100, 0, -4)) - -# Create an animation of the heart icon with changing brightness. -hub.display.animate([Icon.HEART * i/100 for i in brightness], 30) - -# The animation repeats in the background. Here we just wait. -while True: - wait(100) diff --git a/examples/pup/hub_inventorhub/display_expression.py b/examples/pup/hub_inventorhub/display_expression.py deleted file mode 100644 index a20db4c..0000000 --- a/examples/pup/hub_inventorhub/display_expression.py +++ /dev/null @@ -1,32 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.parameters import Icon, Side -from pybricks.tools import wait - -from urandom import randint - -# Initialize the hub. -hub = InventorHub() -hub.display.orientation(up=Side.RIGHT) - -while True: - - # Start with random left brow: up or down. - if randint(0, 100) < 70: - brows = Icon.EYE_LEFT_BROW*0.5 - else: - brows = Icon.EYE_LEFT_BROW_UP*0.5 - - # Add random right brow: up or down. - if randint(0, 100) < 70: - brows += Icon.EYE_RIGHT_BROW*0.5 - else: - brows += Icon.EYE_RIGHT_BROW_UP*0.5 - - for i in range(3): - # Display eyes open plus the random brows. - hub.display.image(Icon.EYE_LEFT + Icon.EYE_RIGHT + brows) - wait(2000) - - # Display eyes blinked plus the random brows. - hub.display.image(Icon.EYE_LEFT_BLINK*0.7 + Icon.EYE_RIGHT_BLINK*0.7 + brows) - wait(200) diff --git a/examples/pup/hub_inventorhub/display_image.py b/examples/pup/hub_inventorhub/display_image.py deleted file mode 100644 index e7ca9bb..0000000 --- a/examples/pup/hub_inventorhub/display_image.py +++ /dev/null @@ -1,18 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.tools import wait -from pybricks.parameters import Icon - -# Initialize the hub. -hub = InventorHub() - -# Display a big arrow pointing up. -hub.display.image(Icon.UP) - -# Wait so we can see what is displayed. -wait(2000) - -# Display a heart at half brightness. -hub.display.image(Icon.HEART / 2) - -# Wait so we can see what is displayed. -wait(2000) diff --git a/examples/pup/hub_inventorhub/display_matrix.py b/examples/pup/hub_inventorhub/display_matrix.py deleted file mode 100644 index 73d5ff6..0000000 --- a/examples/pup/hub_inventorhub/display_matrix.py +++ /dev/null @@ -1,28 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.tools import wait -from pybricks.geometry import Matrix - -# Initialize the hub. -hub = InventorHub() - -# Make a square that is bright on the outside and faint in the middle. -SQUARE = Matrix([ - [100, 100, 100, 100, 100], - [100, 50, 50, 50, 100], - [100, 50, 0, 50, 100], - [100, 50, 50, 50, 100], - [100, 100, 100, 100, 100], -]) - -# Display the square. -hub.display.image(SQUARE) -wait(3000) - -# Make an image using a Python list comprehension. In this image, the -# brightness of each pixel is the sum of the row and column index. So the -# light is faint in the top left and bright in the bottom right. -GRADIENT = Matrix([[(r + c) for c in range(5)] for r in range(5)]) * 12.5 - -# Display the generated gradient. -hub.display.image(GRADIENT) -wait(3000) diff --git a/examples/pup/hub_inventorhub/display_number.py b/examples/pup/hub_inventorhub/display_number.py deleted file mode 100644 index 6d0d777..0000000 --- a/examples/pup/hub_inventorhub/display_number.py +++ /dev/null @@ -1,10 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.tools import wait - -# Initialize the hub. -hub = InventorHub() - -# Count from 0 to 99. -for i in range(100): - hub.display.number(i) - wait(200) diff --git a/examples/pup/hub_inventorhub/display_orientation.py b/examples/pup/hub_inventorhub/display_orientation.py deleted file mode 100644 index cd46cec..0000000 --- a/examples/pup/hub_inventorhub/display_orientation.py +++ /dev/null @@ -1,15 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.tools import wait -from pybricks.parameters import Side - -# Initialize the hub. -hub = InventorHub() - -# Rotate the display. Now right is up. -hub.display.orientation(up=Side.RIGHT) - -# Display a number. This will be shown sideways. -hub.display.number(23) - -# Wait so we can see what is displayed. -wait(10000) diff --git a/examples/pup/hub_inventorhub/display_pixel.py b/examples/pup/hub_inventorhub/display_pixel.py deleted file mode 100644 index f3a2e0c..0000000 --- a/examples/pup/hub_inventorhub/display_pixel.py +++ /dev/null @@ -1,17 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.tools import wait - -# Initialize the hub. -hub = InventorHub() - -# Turn on the pixel at row 1, column 2. -hub.display.pixel(1, 2) -wait(2000) - -# Turn on the pixel at row 2, column 4, at 50% brightness. -hub.display.pixel(2, 4, 50) -wait(2000) - -# Turn off the pixel at row 1, column 2. -hub.display.pixel(1, 2, 0) -wait(2000) diff --git a/examples/pup/hub_inventorhub/display_text.py b/examples/pup/hub_inventorhub/display_text.py deleted file mode 100644 index 065f864..0000000 --- a/examples/pup/hub_inventorhub/display_text.py +++ /dev/null @@ -1,12 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.tools import wait - -# Initialize the hub. -hub = InventorHub() - -# Display the letter A for two seconds. -hub.display.char('A') -wait(2000) - -# Display text, one letter at a time. -hub.display.text('Hello, world!') diff --git a/examples/pup/hub_inventorhub/light_animate.py b/examples/pup/hub_inventorhub/light_animate.py deleted file mode 100644 index e8d7da9..0000000 --- a/examples/pup/hub_inventorhub/light_animate.py +++ /dev/null @@ -1,23 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.parameters import Color -from pybricks.tools import wait -from math import sin, pi - -# Initialize the hub. -hub = InventorHub() - -# Make an animation with multiple colors. -hub.light.animate([Color.RED, Color.GREEN, None], interval=500) - -wait(10000) - -# Make the color RED grow faint and bright using a sine pattern. -hub.light.animate( - [Color.RED * (0.5 * sin(i / 15 * pi) + 0.5) for i in range(30)], 40) - -wait(10000) - -# Cycle through a rainbow of colors. -hub.light.animate([Color(h=i*8) for i in range(45)], interval=40) - -wait(10000) diff --git a/examples/pup/hub_inventorhub/light_blink.py b/examples/pup/hub_inventorhub/light_blink.py deleted file mode 100644 index d94c94b..0000000 --- a/examples/pup/hub_inventorhub/light_blink.py +++ /dev/null @@ -1,16 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.parameters import Color -from pybricks.tools import wait - -# Initialize the hub -hub = InventorHub() - -# Keep blinking red on and off. -hub.light.blink(Color.RED, [500, 500]) - -wait(10000) - -# Keep blinking green slowly and then quickly. -hub.light.blink(Color.GREEN, [500, 500, 50, 900]) - -wait(10000) diff --git a/examples/pup/hub_inventorhub/light_hsv.py b/examples/pup/hub_inventorhub/light_hsv.py deleted file mode 100644 index 4420239..0000000 --- a/examples/pup/hub_inventorhub/light_hsv.py +++ /dev/null @@ -1,21 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.parameters import Color -from pybricks.tools import wait - -# Initialize the hub. -hub = InventorHub() - -# Show the color at 30% brightness. -hub.light.on(Color.RED * 0.3) - -wait(2000) - -# Use your own custom color. -hub.light.on(Color(h=30, s=100, v=50)) - -wait(2000) - -# Go through all the colors. -for hue in range(360): - hub.light.on(Color(hue)) - wait(10) diff --git a/examples/pup/hub_inventorhub/light_off.py b/examples/pup/hub_inventorhub/light_off.py deleted file mode 100644 index 1a23440..0000000 --- a/examples/pup/hub_inventorhub/light_off.py +++ /dev/null @@ -1,15 +0,0 @@ -from pybricks.hubs import InventorHub -from pybricks.parameters import Color -from pybricks.tools import wait - -# Initialize the hub. -hub = InventorHub() - -# Turn the light on and off 5 times. -for i in range(5): - - hub.light.on(Color.RED) - wait(1000) - - hub.light.off() - wait(500) diff --git a/examples/pup/hub_shared/button_main.py b/examples/pup/hub_shared/button_main.py deleted file mode 100644 index 014ec75..0000000 --- a/examples/pup/hub_shared/button_main.py +++ /dev/null @@ -1,29 +0,0 @@ -from pybricks.hubs import ExampleHub -from pybricks.parameters import Button, Icon -from pybricks.tools import wait - -# Initialize the hub. -hub = ExampleHub() - -# Wait for any button to be pressed, and save the result. -pressed = [] -while not any(pressed): - pressed = hub.buttons.pressed() - wait(10) - -# Display a circle. -hub.display.image(Icon.CIRCLE) - -# Wait for all buttons to be released. -while any(hub.buttons.pressed()): - wait(10) - -# Display an arrow to indicate which button was pressed. -if Button.LEFT in pressed: - hub.display.image(Icon.ARROW_LEFT_DOWN) -elif Button.RIGHT in pressed: - hub.display.image(Icon.ARROW_RIGHT_DOWN) -elif Button.BT in pressed: - hub.display.image(Icon.ARROW_RIGHT_UP) - -wait(3000) diff --git a/examples/pup/hub_shared/display_animate.py b/examples/pup/hub_shared/display_animate.py deleted file mode 100644 index f4dadee..0000000 --- a/examples/pup/hub_shared/display_animate.py +++ /dev/null @@ -1,19 +0,0 @@ -from pybricks.hubs import ExampleHub -from pybricks.parameters import Icon -from pybricks.tools import wait - -# Initialize the hub. -hub = ExampleHub() - -# Turn the hub light off (optional). -hub.light.off() - -# Create a list of intensities from 0 to 100 and back. -brightness = list(range(0, 100, 4)) + list(range(100, 0, -4)) - -# Create an animation of the heart icon with changing brightness. -hub.display.animate([Icon.HEART * i/100 for i in brightness], 30) - -# The animation repeats in the background. Here we just wait. -while True: - wait(100) diff --git a/examples/pup/hub_shared/display_expression.py b/examples/pup/hub_shared/display_expression.py deleted file mode 100644 index 052b6f6..0000000 --- a/examples/pup/hub_shared/display_expression.py +++ /dev/null @@ -1,32 +0,0 @@ -from pybricks.hubs import ExampleHub -from pybricks.parameters import Icon, Side -from pybricks.tools import wait - -from urandom import randint - -# Initialize the hub. -hub = ExampleHub() -hub.display.orientation(up=Side.RIGHT) - -while True: - - # Start with random left brow: up or down. - if randint(0, 100) < 70: - brows = Icon.EYE_LEFT_BROW*0.5 - else: - brows = Icon.EYE_LEFT_BROW_UP*0.5 - - # Add random right brow: up or down. - if randint(0, 100) < 70: - brows += Icon.EYE_RIGHT_BROW*0.5 - else: - brows += Icon.EYE_RIGHT_BROW_UP*0.5 - - for i in range(3): - # Display eyes open plus the random brows. - hub.display.image(Icon.EYE_LEFT + Icon.EYE_RIGHT + brows) - wait(2000) - - # Display eyes blinked plus the random brows. - hub.display.image(Icon.EYE_LEFT_BLINK*0.7 + Icon.EYE_RIGHT_BLINK*0.7 + brows) - wait(200) diff --git a/examples/pup/hub_shared/display_image.py b/examples/pup/hub_shared/display_image.py deleted file mode 100644 index fd7712d..0000000 --- a/examples/pup/hub_shared/display_image.py +++ /dev/null @@ -1,18 +0,0 @@ -from pybricks.hubs import ExampleHub -from pybricks.tools import wait -from pybricks.parameters import Icon - -# Initialize the hub. -hub = ExampleHub() - -# Display a big arrow pointing up. -hub.display.image(Icon.UP) - -# Wait so we can see what is displayed. -wait(2000) - -# Display a heart at half brightness. -hub.display.image(Icon.HEART / 2) - -# Wait so we can see what is displayed. -wait(2000) diff --git a/examples/pup/hub_shared/display_matrix.py b/examples/pup/hub_shared/display_matrix.py deleted file mode 100644 index b4ca3b3..0000000 --- a/examples/pup/hub_shared/display_matrix.py +++ /dev/null @@ -1,28 +0,0 @@ -from pybricks.hubs import ExampleHub -from pybricks.tools import wait -from pybricks.geometry import Matrix - -# Initialize the hub. -hub = ExampleHub() - -# Make a square that is bright on the outside and faint in the middle. -SQUARE = Matrix([ - [100, 100, 100, 100, 100], - [100, 50, 50, 50, 100], - [100, 50, 0, 50, 100], - [100, 50, 50, 50, 100], - [100, 100, 100, 100, 100], -]) - -# Display the square. -hub.display.image(SQUARE) -wait(3000) - -# Make an image using a Python list comprehension. In this image, the -# brightness of each pixel is the sum of the row and column index. So the -# light is faint in the top left and bright in the bottom right. -GRADIENT = Matrix([[(r + c) for c in range(5)] for r in range(5)]) * 12.5 - -# Display the generated gradient. -hub.display.image(GRADIENT) -wait(3000) diff --git a/examples/pup/hub_shared/display_number.py b/examples/pup/hub_shared/display_number.py deleted file mode 100644 index b61b90b..0000000 --- a/examples/pup/hub_shared/display_number.py +++ /dev/null @@ -1,10 +0,0 @@ -from pybricks.hubs import ExampleHub -from pybricks.tools import wait - -# Initialize the hub. -hub = ExampleHub() - -# Count from 0 to 99. -for i in range(100): - hub.display.number(i) - wait(200) diff --git a/examples/pup/hub_shared/display_orientation.py b/examples/pup/hub_shared/display_orientation.py deleted file mode 100644 index 85448ee..0000000 --- a/examples/pup/hub_shared/display_orientation.py +++ /dev/null @@ -1,15 +0,0 @@ -from pybricks.hubs import ExampleHub -from pybricks.tools import wait -from pybricks.parameters import Side - -# Initialize the hub. -hub = ExampleHub() - -# Rotate the display. Now right is up. -hub.display.orientation(up=Side.RIGHT) - -# Display a number. This will be shown sideways. -hub.display.number(23) - -# Wait so we can see what is displayed. -wait(10000) diff --git a/examples/pup/hub_shared/display_pixel.py b/examples/pup/hub_shared/display_pixel.py deleted file mode 100644 index 40e375c..0000000 --- a/examples/pup/hub_shared/display_pixel.py +++ /dev/null @@ -1,17 +0,0 @@ -from pybricks.hubs import ExampleHub -from pybricks.tools import wait - -# Initialize the hub. -hub = ExampleHub() - -# Turn on the pixel at row 1, column 2. -hub.display.pixel(1, 2) -wait(2000) - -# Turn on the pixel at row 2, column 4, at 50% brightness. -hub.display.pixel(2, 4, 50) -wait(2000) - -# Turn off the pixel at row 1, column 2. -hub.display.pixel(1, 2, 0) -wait(2000) diff --git a/examples/pup/hub_shared/display_text.py b/examples/pup/hub_shared/display_text.py deleted file mode 100644 index a6b65aa..0000000 --- a/examples/pup/hub_shared/display_text.py +++ /dev/null @@ -1,12 +0,0 @@ -from pybricks.hubs import ExampleHub -from pybricks.tools import wait - -# Initialize the hub. -hub = ExampleHub() - -# Display the letter A for two seconds. -hub.display.char('A') -wait(2000) - -# Display text, one letter at a time. -hub.display.text('Hello, world!')