2

I have sample app that wait on signal from IR sensor that is connected to GPIO15 and 14:

ser = serial.Serial(port="/dev/ttyAMA0",baudrate=115200, timeout=1)
io.add_event_detect(15,io.RISING, callback=inputLow, bouncetime=200)
def inputLow(channel):
  print('signal test')

And now I want to run screen: screen /dev/ttyAMA0 115200

  • 1) I can only run screen because when I run above application I get error device ttyAMA0 is busy
  • 2) when I run only gnu screen in terminal I see only black screen, when I send signal to IR sensor on the terminal nothing happens, screen is black

How can I read data from ttyAMA0?

user79083
  • 21
  • 2

1 Answers1

2

There is ABSOLUTELY NO REASON to use /dev/ttyAMA0 in a moderately up-to-date OS. This is connected to Bluetooth (by default) on Pi3 and PiZeroW.

In ALL models use /dev/serial0 which is the default serial port (if enabled), even if ports are swapped.

See How-do-i-make-serial-work-on-the-raspberry-pi3

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • my OS is Jessy, so I should use ttyS0 or /dev/serial0? – Robert Jan 09 '18 at 10:45
  • @Robert I don't know this `Jessy` but the earliest implementations of Raspbian supporting the Pi3 were half baked and poorly documented (which was the reason for my linked post), You can check if `/dev/serial0` exists. – Milliways Jan 09 '18 at 10:52
  • ok, ls -l /dev and I see: ttyS0 and ttyAMA0 and serial0->ttyS0, serial1->ttyAMA0 – Robert Jan 09 '18 at 11:05