#!/usr/bin/python # -*- coding: iso-8859-1 -*- import serial import math # Iniciando conexao serial comport = serial.Serial('/dev/cu.usbmodem1421', 9600) while 1: linha=comport.readline() vetorAngRaio = map(int, linha.split()) angulo = vetorAngRaio[0] raio = vetorAngRaio[1] x = raio * math.cos(math.radians(angulo)) y = raio * math.sin(math.radians(angulo)) print 'x: %s' % (x) print 'y: %s' % (y) # Fechando conexao serial comport.close()