Trying to send and receive to serial through Bash

Hi,

I am trying to write a really simple script in order to automate some data collection from my adafruit sensor.

The script looks something like this.

#!/bin/bash
for x in {A..T}
do
    echo -e "2$x" > /dev/ttyACM0
    sleep 6
done

I am using the below commands to get the output from the serial.

stty -F /dev/ttyACM0 raw 115200
cat /dev/ttyACM0

When I am running the bash script, for some reason there are some extra characters added to the input.

Screenshot from 2023-09-13 16-47-07

Can someone help me understand why this is happening and how can I fix this?
Any help is appreciated. Thank you

^M is CR - 0D;
^J is LF - 0A

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.