forked from mu-editor/mu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09cbe64
commit a6fc099
Showing
4 changed files
with
100 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
result = False | ||
|
||
while not result: | ||
try: | ||
Voice.tts("I'm hearing. Please speak in 3 secconds.") | ||
print("Eshityapman. 3 soniya ichida gapirib bering.") | ||
result = Voice.stt() | ||
print(result) | ||
if result == "Chiroqni yoq": | ||
n.led_on() | ||
wait(3000) | ||
elif result == "Chiroqni o'chir": | ||
n.led_off() | ||
wait(3000) | ||
except: | ||
result = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from pgzhelper import * | ||
from pgzhelper import Util | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
fd = FaceDetection() | ||
|
||
WIDTH = 640 | ||
HEIGHT = 480 | ||
pygame_img = None | ||
detected = False | ||
red_led = Actor('red_led_off', (600, 60)) | ||
red_led.images = ['red_led_on', 'red_led_off'] | ||
red_led.scale = 0.5 | ||
red_led.fps = 15 | ||
|
||
fd = FaceDetection() | ||
if fd.camera_open(1) is False: | ||
game.exit() | ||
|
||
def draw(): | ||
if detected: | ||
screen.blit(pygame_img, (0, 0)) | ||
red_led.draw() | ||
n.led_on() | ||
n.buzzer() | ||
n.led_off() | ||
else: | ||
screen.blit('living_room', (0, 0)) | ||
|
||
def update(): | ||
global pygame_img | ||
global detected | ||
|
||
frame, faces = fd.start_detection(just_rtn_frame=True) | ||
pygame_img = Util.opencv_to_pygame_img(frame) | ||
|
||
if faces > 0: | ||
detected = True | ||
red_led.next_image() | ||
print('Detected!!!') | ||
else: | ||
detected = False | ||
|
||
|
||
def on_key_down(key): | ||
if key == keys.SPACE: | ||
game.exit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
od = ObjectDetection() | ||
|
||
if od.camera_open(0): | ||
while True: | ||
result = od.start_detection() | ||
if result: | ||
obj_names, obj_coords = result | ||
if 'sports ball' in obj_names: | ||
n.led_on('out1', '100') | ||
n.motor_rotate('both', 'forward', '10') | ||
wait(1000) | ||
n.led_off('out1') | ||
else: | ||
n.motor_rotate('both', 'left', '10') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters