I have bought an inclinometer today to try some things.
Inclinometer has two communication port; RS232 and UART.
Which one should I select? Actually I tried both but none of them worked.
I have followed all the instructions on this page : http://elinux.org/RPi_Serial_Connection#Connection_to_a_microcontroller_or_other_peripheral
I have tried both with minicom and this small python script:
import serial import time port = serial.Serial( port='/dev/ttyAMA0', baudrate=38400, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, interCharTimeout=0.1, timeout=1 ) print("Port Name: %s" % port.name) while True: port.write(bytes("get---x", 'iso-8859-1')) rcv = port.read(10) print(rcv) time.sleep(0.5)
Datasheet is here
I have followed this page when I connecting the inclinometer;
- pin1: (Red) +ve Supply 3.3V
- pin6: (Black) Ground (0V)
- pin8: (Green) UART Tx
- pin10: (Yellow) UART Rx
What I am doing wrong?