#!/usr/bin/python
# -*- coding: utf-8 -*-

'''
// Pointer Robot with Raspbery Pi and Arduino
// Copyright (C) 2018, ArduinoDeXXX All Rights Reserved.
//
// information:
// This is a sample code to make Raspberry Pi communicate with Arduino by UART.
// Connect RX and TX pins on Raspberry Pi into TX and RX pins on Arduino NANO
// via a logic level converter.
//
// This sample code is provided for an article to get Pointer robot.
// View the sites bellow to see more detail.
// https://www.instructables.com/id/Pointer-Robot-With-RPi-and-Arduino/
// https://www.instructables.com/id/Pointer-Robot-With-RPi-and-Arduino-JPN/
'''

import serial
import time
import sys
import RPi.GPIO as GPIO

s = serial.Serial('/dev/ttyAMA0', 115200, timeout=2)

deg = sys.argv[1]
deg = deg + "\n"
s.write(deg)

s.close()
