mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Supprimé twins/rp_maqueen-relay.py.~1~, twins/rp_maqueen-robot.py.~1~, twins/rp_twins-maqueen.py.~1~, twins/rp_twins-microbit.py.~1~
This commit is contained in:
parent
2c6b296ac3
commit
cdba65ab3b
@ -1,24 +0,0 @@
|
|||||||
from microbit import uart, sleep
|
|
||||||
from microbit import *
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# rp_twins_maqueen-beacon.py
|
|
||||||
# @title: Jumeau Maqueen : Programme de la carte microbit du relai
|
|
||||||
# @project: Ropy (Blender-EduTech)
|
|
||||||
# @lang: fr
|
|
||||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
|
||||||
# @copyright: Copyright (C) 2022 Philippe Roy
|
|
||||||
# @license: GNU GPL
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
uart.init(baudrate= 115200) # Initialisation du port série
|
|
||||||
|
|
||||||
while True:
|
|
||||||
|
|
||||||
while not uart.any(): # Attente d'un message
|
|
||||||
pass
|
|
||||||
|
|
||||||
display.scroll('ok : ') # Réception d'une message
|
|
||||||
content = uart.readline()
|
|
||||||
display.scroll(content[:-1]) # Affichage du message sans le '/n'
|
|
||||||
sleep(400)
|
|
@ -1,113 +0,0 @@
|
|||||||
from microbit import *
|
|
||||||
from machine import *
|
|
||||||
import music
|
|
||||||
import radio
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# rp_twins_maqueen-robot.py
|
|
||||||
# @title: Jumeau Maqueen : Programme de la carte microbit du robot
|
|
||||||
# @project: Ropy (Blender-EduTech)
|
|
||||||
# @lang: fr
|
|
||||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
|
||||||
# @copyright: Copyright (C) 2022 Philippe Roy
|
|
||||||
# @license: GNU GPL
|
|
||||||
#
|
|
||||||
# Programme d'execution des ordres de la manette pour le robot Maqueen#
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# ###############################################################################
|
|
||||||
# Initialisation
|
|
||||||
# ###############################################################################
|
|
||||||
|
|
||||||
led_image = Image('00000:00000:00900:00000:00000')
|
|
||||||
display.show(led_image) # Témoin de fonctionnement
|
|
||||||
radio.config(group=1, queue=1, length=8)
|
|
||||||
radio.on()
|
|
||||||
|
|
||||||
# ###############################################################################
|
|
||||||
# Boucle principale
|
|
||||||
# ###############################################################################
|
|
||||||
|
|
||||||
while True:
|
|
||||||
|
|
||||||
v_avancer = 50
|
|
||||||
v_tourner = 50
|
|
||||||
v_tourner_faible = 25
|
|
||||||
|
|
||||||
# Lecture de l'ordre
|
|
||||||
ordre=radio.receive()
|
|
||||||
|
|
||||||
# Avancer
|
|
||||||
if ordre=="AV":
|
|
||||||
display.show(Image.ARROW_N)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(1) # Led avant gauche
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, v_avancer])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x0, v_avancer])) # Moteur droit
|
|
||||||
|
|
||||||
# Reculer
|
|
||||||
if ordre=="RE":
|
|
||||||
display.show(Image.ARROW_S)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(1) # Led avant gauche
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x1, v_avancer])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x1, v_avancer])) # Moteur droit
|
|
||||||
|
|
||||||
# Gauche
|
|
||||||
if ordre=="GA":
|
|
||||||
display.show(Image.ARROW_W)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, 0])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x0, v_tourner])) # Moteur droit
|
|
||||||
|
|
||||||
# Avancer + gauche
|
|
||||||
if ordre=="AG":
|
|
||||||
display.show(Image.ARROW_W)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, v_tourner_faible])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x0, v_tourner])) # Moteur droit
|
|
||||||
|
|
||||||
# Reculer + gauche
|
|
||||||
if ordre=="RG":
|
|
||||||
display.show(Image.ARROW_W)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x1, v_tourner_faible])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x1, v_tourner])) # Moteur droit
|
|
||||||
|
|
||||||
# Droite
|
|
||||||
if ordre=="DR":
|
|
||||||
display.show(Image.ARROW_E)
|
|
||||||
pin8.write_digital(0) # Led avant gauche
|
|
||||||
pin12.write_digital(1) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, v_tourner])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x0, 0])) # Moteur droit
|
|
||||||
|
|
||||||
# Avancer + droite
|
|
||||||
if ordre=="AD":
|
|
||||||
display.show(Image.ARROW_W)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, v_tourner])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x0, v_tourner_faible])) # Moteur droit
|
|
||||||
|
|
||||||
# Reculer + droite
|
|
||||||
if ordre=="RD":
|
|
||||||
display.show(Image.ARROW_W)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x1, v_tourner])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x1, v_tourner_faible])) # Moteur droit
|
|
||||||
|
|
||||||
# Stop
|
|
||||||
if ordre=="ST":
|
|
||||||
display.show(led_image) # Témoin de fonctionnement
|
|
||||||
pin8.write_digital(0) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, 0]))
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x1, 0]))
|
|
||||||
|
|
||||||
# Cadencement
|
|
||||||
# sleep(10)
|
|
@ -1,114 +0,0 @@
|
|||||||
from microbit import *
|
|
||||||
from machine import *
|
|
||||||
import music
|
|
||||||
import radio
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# maqueen_robot.py:
|
|
||||||
# @title: Robot Maqueen
|
|
||||||
# @project:
|
|
||||||
# @lang: fr
|
|
||||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
|
||||||
# @copyright: Copyright (C) 2022 Philippe Roy
|
|
||||||
# @license: GNU GPL
|
|
||||||
#
|
|
||||||
# Programme d'execution des ordres de la manette pour le robot Maqueen
|
|
||||||
#
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
# ###############################################################################
|
|
||||||
# Initialisation
|
|
||||||
# ###############################################################################
|
|
||||||
|
|
||||||
led_image = Image('00000:00000:00900:00000:00000')
|
|
||||||
display.show(led_image) # Témoin de fonctionnement
|
|
||||||
radio.config(group=1, queue=1, length=8)
|
|
||||||
radio.on()
|
|
||||||
|
|
||||||
# ###############################################################################
|
|
||||||
# Boucle principale
|
|
||||||
# ###############################################################################
|
|
||||||
|
|
||||||
while True:
|
|
||||||
|
|
||||||
v_avancer = 50
|
|
||||||
v_tourner = 50
|
|
||||||
v_tourner_faible = 25
|
|
||||||
|
|
||||||
# Lecture de l'ordre
|
|
||||||
ordre=radio.receive()
|
|
||||||
|
|
||||||
# Avancer
|
|
||||||
if ordre=="AV":
|
|
||||||
display.show(Image.ARROW_N)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(1) # Led avant gauche
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, v_avancer])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x0, v_avancer])) # Moteur droit
|
|
||||||
|
|
||||||
# Reculer
|
|
||||||
if ordre=="RE":
|
|
||||||
display.show(Image.ARROW_S)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(1) # Led avant gauche
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x1, v_avancer])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x1, v_avancer])) # Moteur droit
|
|
||||||
|
|
||||||
# Gauche
|
|
||||||
if ordre=="GA":
|
|
||||||
display.show(Image.ARROW_W)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, 0])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x0, v_tourner])) # Moteur droit
|
|
||||||
|
|
||||||
# Avancer + gauche
|
|
||||||
if ordre=="AG":
|
|
||||||
display.show(Image.ARROW_W)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, v_tourner_faible])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x0, v_tourner])) # Moteur droit
|
|
||||||
|
|
||||||
# Reculer + gauche
|
|
||||||
if ordre=="RG":
|
|
||||||
display.show(Image.ARROW_W)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x1, v_tourner_faible])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x1, v_tourner])) # Moteur droit
|
|
||||||
|
|
||||||
# Droite
|
|
||||||
if ordre=="DR":
|
|
||||||
display.show(Image.ARROW_E)
|
|
||||||
pin8.write_digital(0) # Led avant gauche
|
|
||||||
pin12.write_digital(1) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, v_tourner])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x0, 0])) # Moteur droit
|
|
||||||
|
|
||||||
# Avancer + droite
|
|
||||||
if ordre=="AD":
|
|
||||||
display.show(Image.ARROW_W)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, v_tourner])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x0, v_tourner_faible])) # Moteur droit
|
|
||||||
|
|
||||||
# Reculer + droite
|
|
||||||
if ordre=="RD":
|
|
||||||
display.show(Image.ARROW_W)
|
|
||||||
pin8.write_digital(1) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x1, v_tourner])) # Moteur gauche
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x1, v_tourner_faible])) # Moteur droit
|
|
||||||
|
|
||||||
# Stop
|
|
||||||
if ordre=="ST":
|
|
||||||
display.show(led_image) # Témoin de fonctionnement
|
|
||||||
pin8.write_digital(0) # Led avant gauche
|
|
||||||
pin12.write_digital(0) # Led avant droit
|
|
||||||
i2c.write(0x10, bytearray([0x00, 0x0, 0]))
|
|
||||||
i2c.write(0x10, bytearray([0x02, 0x1, 0]))
|
|
||||||
|
|
||||||
# Cadencement
|
|
||||||
# sleep(10)
|
|
@ -1,20 +0,0 @@
|
|||||||
from microbit import uart, sleep
|
|
||||||
from microbit import *
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# microbit-lecteur_portserie.py
|
|
||||||
# @title: Lecteur du port serie d'une carte micro:bit
|
|
||||||
# @project: Ropy (Blender-EduTech)
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
uart.init(baudrate= 115200) # Initialisation du port série
|
|
||||||
|
|
||||||
while True:
|
|
||||||
|
|
||||||
while not uart.any(): # Attente d'un message
|
|
||||||
pass
|
|
||||||
|
|
||||||
display.scroll('ok : ') # Réception d'une message
|
|
||||||
content = uart.readline()
|
|
||||||
display.scroll(content[:-1]) # Affichage du message sans le '/n'
|
|
||||||
sleep(400)
|
|
Loading…
x
Reference in New Issue
Block a user