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.
Adding neopia directory with it's examples.
- Loading branch information
Showing
58 changed files
with
273 additions
and
0 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
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,15 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
|
||
# LEDni yoqib 1 soniyadan keyin o'chirish | ||
n.led_on('out1','100') | ||
wait(1000) # milisekund orqali hisoblanadi | ||
|
||
|
||
# Takrorlab miltiratish | ||
while True: | ||
n.led_on('out1','100') | ||
wait(1000) | ||
n.led_off('out1') | ||
wait(1000) |
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,15 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
key = Keyboard.read() | ||
if key == Keyboard.UP: | ||
n.motor_rotate('both', 'forward', '10') | ||
elif key == Keyboard.DOWN: | ||
n.motor_rotate('both', 'backward', '10') | ||
elif key == Keyboard.LEFT: | ||
n.motor_rotate('both', 'left', '10') | ||
elif key == Keyboard.RIGHT: | ||
n.motor_rotate('both', 'right', '10') | ||
elif key == ' ': | ||
n.motor_stop('both') |
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,9 @@ | ||
# Ichki buzzer orqali yangrash | ||
|
||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
n.buzzer_by_port('in1') | ||
wait(200) | ||
n.buzzer_stop() |
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,11 @@ | ||
# Ovoz sensor orqali Baramining tezligini boshqarish | ||
|
||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
if n.get_value('in3') < 30: | ||
n.motor_stop('right') | ||
else: | ||
n.motor_rotate('right', 'forward', 'in3') | ||
|
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,15 @@ | ||
# Klaviatura orqali Baramining tezligini boshqarish | ||
|
||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
key = Keyboard.read() | ||
if key == '0': | ||
n.motor_stop('right') | ||
elif key == '1': | ||
n.motor_rotate('right', 'forward', '10') | ||
elif key == '2': | ||
n.motor_rotate('right', 'forward', '50') | ||
elif key == '3': | ||
n.motor_rotate('right', 'forward', '100') |
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,13 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
|
||
while True: | ||
while n.get_value('in3') > 50: | ||
continue | ||
while n.get_value('in3') <= 50: | ||
continue | ||
|
||
n.motor_rotate('both', 'left', '50') | ||
wait(3000) | ||
n.motor_stop('both') |
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,8 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
if n.get_value('in1') < 20: | ||
n.motor_rotate('both', 'forward', '50') | ||
else: | ||
n.motor_stop('both') |
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,16 @@ | ||
# Masofa sensor orqali to’siqdan qochish dasturi | ||
|
||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
if n.get_value('in2') <= 7: | ||
n.motor_move('backward') | ||
wait(500) | ||
n.motor_stop('both') | ||
n.motor_move('left') | ||
wait(1000) | ||
n.motor_stop('both') | ||
else: | ||
n.motor_rotate('both', 'forward', '50') | ||
|
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,8 @@ | ||
# Acc Kontrol dasturalsh | ||
|
||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
n.motor_rotate('both', 'forward', 'in2') | ||
n.buzzer_by_port('in2') |
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,11 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
if n.get_value('in1') and n.get_value('in2') > 40: | ||
n.motor_rotate('both', 'forward', '30') | ||
else: | ||
if n.get_value('in1') <= 40: | ||
n.motor_stop('left') | ||
if n.get_value('in2') <= 40: | ||
n.motor_stop('right') |
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,15 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
if n.get_value('in1') and n.get_value('in2') > 40: | ||
n.motor_rotate('both', 'forward', '30') | ||
else: | ||
if n.get_value('in1') <= 40: | ||
n.motor_stop('left') | ||
if n.get_value('in2') <= 40: | ||
n.motor_stop('right') | ||
if n.get_value('in1') and n.get_value('in2') <= 40: | ||
n.motor_move('left') | ||
wait(500) | ||
n.motor_stop('both') |
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,8 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
if n.get_value('in1') == 255: | ||
n.led_on('out1', '100') | ||
else: | ||
n.led_off('out1') |
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,24 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
if n.get_value('in2') <= 10: | ||
n.motor_stop('both') | ||
n.servo_reset_degree('out3') | ||
wait(100) | ||
n.servo_rotate_by_degree('out3', 'forward', '100', '90') | ||
wait(1000) | ||
chap_m = n.get_value('in2') | ||
n.servo_rotate_by_degree('out3', 'backward', '100', '90') | ||
wait(1000) | ||
ong_m = n.get_value('in2') | ||
n.servo_rotate_by_degree('out3', 'forward', '100', '0') | ||
wait(1000) | ||
if chap_m > ong_m: | ||
n.motor_rotate('both', 'left', '50') | ||
wait(1000) | ||
else: | ||
n.motor_rotate('both', 'right', '50') | ||
wait(1000) | ||
else: | ||
n.motor_rotate('both', 'forward', '50') |
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,31 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
# Masofa sensor orqali to‘siqni tekshirish uchun funksiya yaratish | ||
def servo_motor(): | ||
n.motor_stop('both') | ||
n.servo_reset_degree('out3') | ||
wait(100) | ||
n.servo_rotate_by_degree('out3', 'forward', '100', '90') | ||
wait(1000) | ||
global chap_m | ||
chap_m = n.get_value('in2') | ||
n.servo_rotate_by_degree('out3', 'backward', '100', '90') | ||
wait(1000) | ||
global ong_m | ||
ong_m = n.get_value('in2') | ||
n.servo_rotate_by_degree('out3', 'forward', '100', '0') | ||
wait(1000) | ||
|
||
# Funksiyadan foydalanib dastur tuzish | ||
while True: | ||
if n.get_value('in2') <= 10: | ||
servo_motor() | ||
if chap_m > ong_m: | ||
n.motor_rotate('both', 'right', '50') | ||
wait(1000) | ||
else: | ||
n.motor_rotate('both', 'left', '50') | ||
wait(1000) | ||
else: | ||
n.motor_rotate('both', 'forward', '50') |
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,10 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
n.servo_reset_degree('out1') | ||
while True: | ||
key = Keyboard.read() | ||
if key == '4': | ||
n.servo_rotate_by_degree('out1', 'forward', '20', '60') | ||
if key == '1': | ||
n.servo_rotate_by_degree('out1', 'forward', '20', '0') |
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,16 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
while True: | ||
if n.get_value('in1') < 80 and n.get_value('in2') < 80: | ||
n.servo_stop('out1') | ||
n.motor_stop('both') | ||
elif n.get_value('in1') > 80 and n.get_value('in2') > 80: | ||
n.servo_stop('out1') | ||
n.motor_rotate('both', 'backward', '40') | ||
elif n.get_value('in1') > 80 and n.get_value('in2') < 80: | ||
n.servo_rotate('out1', 'forward', '10') | ||
n.motor_rotate('both', 'forward', '30') | ||
elif n.get_value('in1') < 80 and n.get_value('in2') > 80: | ||
n.servo_rotate('out1', 'backward', '10') | ||
n.motor_rotate('both', 'forward', '30') |
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,13 @@ | ||
from neopia import * | ||
|
||
n = Neosoco() | ||
n.servo_reset_degree('out1') | ||
n.motor_rotate('both', 'forward', '40') | ||
while True: | ||
if n.get_value('in1') > 20 and n.get_value('in2') > 20: | ||
n.servo_rotate_by_degree('out1', 'forward', '50', '20') | ||
wait(500) | ||
if n.get_value('in1') <= 20 and n.get_value('in2') <= 20: | ||
if n.get_value('in2') > 0: | ||
n.servo_rotate_by_degree('out1', 'backward', '50', '20') | ||
wait(500) |
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.