# 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 # Una ves terminado el dibujo, levanta el lapiz y cierra el programa robot.levantar_lapiz() robot.cerrar()
# 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) def punto(caracter): drawbot.adelante(caracter)