Commit 908eeb34 authored by Felix Kettner's avatar Felix Kettner

add tests for new features

parent 3c8c2d6d
Pipeline #34324 passed with stage
in 36 seconds
...@@ -11,6 +11,7 @@ from pibot.nano import Nano ...@@ -11,6 +11,7 @@ from pibot.nano import Nano
from pibot.buttons import * from pibot.buttons import *
from pibot import constants as c from pibot import constants as c
from pibot import leds from pibot import leds
from pibot import colorsensor
MENU_TOGGLE_PIN = 21 MENU_TOGGLE_PIN = 21
...@@ -34,10 +35,13 @@ def menu(lcd): ...@@ -34,10 +35,13 @@ def menu(lcd):
('Poweroff', poweroff), ('Poweroff', poweroff),
('Show IP', show_ip), ('Show IP', show_ip),
('Motor Test', actuator_test), ('Motor Test', actuator_test),
('Sensor Test', sensor_test), ('US-Sensor Test', sensor_test),
('LED Test', led_test), ('LED Test', led_test),
('Camera Test', camera_test), ('Camera Test', camera_test),
('Buzzer Test', buzzer_test)] ('Buzzer Test', buzzer_test),
('L-Sensor Test', l_sensor_test),
('Greifer Test', gripper_test),
('C-Sensor Test', c_sensor_test),]
current = 1 current = 1
in_menu = True in_menu = True
...@@ -146,6 +150,64 @@ def sensor_test(lcd): ...@@ -146,6 +150,64 @@ def sensor_test(lcd):
leds.set_led(c.LED_MID, c.OFF) leds.set_led(c.LED_MID, c.OFF)
def l_sensor_test(lcd):
message = ["Requesting",
"Nano!",
""]
lcd.print(message)
nano = Nano()
leds.init_leds()
leds.set_led(c.LED_MID, c.GREEN)
while not is_pressed(c.BUTTON_MID):
message = [str(nano.get_line_sensors()),
"",
" ok"]
lcd.print(message)
leds.set_led(c.LED_MID, c.OFF)
def gripper_test(lcd):
message = ["Requesting",
"Nano!",
""]
lcd.print(message)
nano = Nano()
leds.init_leds()
leds.set_led(c.LED_MID, c.GREEN)
message = ["",
"",
"open close"]
lcd.print(message)
end = False
while not end:
button = wait_for_any()
if button == c.BUTTON_LEFT:
nano.open_gripper()
elif button == c.BUTTON_RIGHT:
nano.close_gripper()
else:
end = True
nano.open_gripper()
leds.set_led(c.LED_MID, c.OFF)
def c_sensor_test(lcd):
message = ["Requesting",
"Nano!",
""]
lcd.print(message)
nano = Nano()
leds.init_leds()
leds.set_led(c.LED_MID, c.GREEN)
colorsensor.init_color_sensor()
while not is_pressed(c.BUTTON_MID):
message = [str(nano.get_color()),
"",
" ok"]
lcd.print(message)
leds.set_led(c.LED_MID, c.OFF)
def led_test(lcd): def led_test(lcd):
message = ["Testing", message = ["Testing",
"LED's!", "LED's!",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment