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?

  • What model Pi? Have you enabled serial? – Milliways Jan 9 '18 at 9:11
  • RPi3, yes I've enabled – Robert Jan 9 '18 at 9:42
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

  • my OS is Jessy, so I should use ttyS0 or /dev/serial0? – Robert Jan 9 '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 9 '18 at 10:52
  • ok, ls -l /dev and I see: ttyS0 and ttyAMA0 and serial0->ttyS0, serial1->ttyAMA0 – Robert Jan 9 '18 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.