# 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) def punto(caracter): drawbot.adelante(caracter)
# 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° # Cambiando el valor de "lados" podemos dibujar cualquier poligono regular
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')) primitive_dictionary['robot_adelante'] = self._rb_adelante palette.add_block('robot_adelante', style='basic-style-1arg', label=_('robot_adelante'),