# it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # from libreria.vplot import ROBOT robot = ROBOT() # este es el "nombre" de nuestro robot. robot.iniciar() # iniciamos la conexion robot.bajar_lapiz() # bajo el lapiz para que apoye sobre el papel lados = 20 largo = 50 for a in range(360 / ((360 / lados) / 2)): for b in range(lados): robot.adelante(largo) robot.derecha(360 / lados) robot.derecha((360 / lados) / 2) # Una ves terminado el dibujo, levanta el lapiz y cierra el programa robot.levantar_lapiz() robot.cerrar()
# it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # from libreria.vplot import ROBOT robot = ROBOT() # este es el "nombre" de nuestro robot. robot.iniciar() # iniciamos la conexion robot.bajar_lapiz() # bajo el lapiz para que apoye sobre el papel # Las varaibles son "cajas" donde se puede almacenar un valor y cambiarlo a # medida que nuestro programa se va ejecutando, permiten almacenar cualquier # valor, numeros, cadenas de caracteres y muchas cosas mas. # en este ejemplo, la variable "Lados" determina la cantidad de lados que va a # tener el poligono que vamos a dibujar con nuestro robot. lados = 5 for a in range(lados): robot.adelante(100) robot.derecha(360 / lados) # la suma de los angulos de un poligono regular # es igual a 360, por lo tanto si tenemos 5 angulos # cada uno de ellos tiene que ser de 360/5= 72°
# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # from libreria.vplot import ROBOT robot = ROBOT() # este es el "nombre" de nuestro robot. robot.iniciar() # iniciamos la conexion robot.bajar_lapiz() # bajo el lapiz para que apoye sobre el papel angulo = 3 for m in range(12): robot.bajar_lapiz() for a in range(1, 36, 3): robot.adelante(9 + a) robot.derecha(360 / angulo) robot.levantar_lapiz() robot.poner_a_cero() robot.derecha(30) robot.atras(a)
# it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # from libreria.vplot import ROBOT robot = ROBOT() # este es el "nombre" de nuestro robot. robot.iniciar() # iniciamos la conexion robot.bajar_lapiz() # bajo el lapiz para que apoye sobre el papel # En este ejercicio, usamos 2 bucles, uno adentro del otro, lo que se denomina # un "bucle anidado", en cada interación del bucle A, se haran 3 repeticiones # del codigo fuente del bucle B (dibujando un triangulo). for a in range(4): # bucle A for b in range(3): # bucle B robot.adelante(200) robot.derecha(120) robot.derecha(90) # gira para que el robot no dibuje el mismo triangulo # sobre la misma superficie
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. # # from PIL import Image from libreria.vplot import ROBOT drawbot = ROBOT() #drawbot.PUERTO="/dev/ttyACM1" drawbot.cerrar() drawbot.iniciar() caracter = 8 def blanco(): """TODO: Docstring for blanco. :returns: TODO """ drawbot.adelante(caracter)
from plugins.plugin import Plugin from TurtleArt.tapalette import make_palette from TurtleArt.talogo import media_blocks_dictionary from TurtleArt.talogo import primitive_dictionary from TurtleArt.tautils import debug_output from TurtleArt.tautils import get_path import logging _logger = logging.getLogger('turtleart-activity icaro plugin') #import apicaro #puerto = apicaro.puerto() from libreria.vplot import ROBOT import time robot=ROBOT() # este es el "nombre" de nuestro robot. robot.PUERTO = '/dev/ttyACM0' robot.iniciar() class Icaro(Plugin): def __init__(self, parent): self._parent = parent self._status = False def setup(self): palette = make_palette('icaro', colors=["#006060", "#A00000"], help_string=_('paleta de bloques icaro'))
# it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # from libreria.vplot import ROBOT robot = ROBOT() # este es el "nombre" de nuestro robot. robot.iniciar() # iniciamos la conexion robot.bajar_lapiz() # bajo el lapiz para que apoye sobre el papel for a in range(10): for b in range(20): for b in range(4): robot.adelante(10) robot.derecha(90) robot.adelante(10) robot.derecha(90) robot.adelante(10) robot.derecha(90) for b in range(20): for b in range(4):