Serial Port for Serial LoggingΒΆ

The USB-Serial port on the Sensorian can be used for debugging and logging. It can be accessed in Python using the serial module. The Sensorian USB-Serial port is /dev/ttyAMA0. The following code example illustrates this.

import serial

def main():
        ser = serial.Serial('/dev/ttyAMA0',9600)
        ser.write('Read data from terminal')

        while True:
                c = ser.read()
                print(c)

if __name__ == '__main__':
        try:
                main()
        except KeyboardInterrupt:
                print("")

__author__      = "Dhimiter Qendri"
__copyright__   = "Copyright Sensorian 2015"

Previous topic

Welcome to Sensorian Python Library Reference Guide

Next topic

Ambient Light Sensor

This Page