'''
Created on 2015.07.12

@author: K. Michalsky
'''

# import the serial library
import serial, time

# Boolean variable that will represent whether or not the arduino is connected
connected = False

# open the serial port that your arduino is connected to.
ser = serial.Serial("/dev/tty.usbmodem1411", 9600)
print(ser.name)

# loop until the arduino tells us the serial connection is ready
while not connected:
    serin = ser.read()
    connected = True

# if serial available save value in var, print value and clear it afterwards for new input
while True:
    var=ser.read()
    print(var)
    del var

# close the port and end the program
ser.close()
