Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6829241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:28:40+00:00 2026-05-26T22:28:40+00:00

I have an Arduino which I have coded to read from a USB serial

  • 0

I have an Arduino which I have coded to read from a USB serial port and power an LED.
I know it is working because it works on the built serial monitor. Now I want to write a Bash script which writes to the serial port.

Here is the command:

 echo 121 > /dev/cu.usbmodem411

It outputs the string “123”. How can I instead write a single byte with a value of 121?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:28:40+00:00Added an answer on May 26, 2026 at 10:28 pm
    echo 121 > /dev/cu.usbmodem411
    

    will write four bytes: 0x31 (meaning ‘1’), 0x32 (meaning ‘2’), 0x31 again, 0x0A (meaning a newline).

    If your goal is to write a single byte, with value 121, you would write this:

    echo -n $'\171' > /dev/cu.usbmodem411
    

    where 171 is 121 expressed in base-8, and -n tells echo not to print a newline character.

    If that’s not your goal, then please clarify.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Arduino board connected to my PC's serial port. The board sends
I have Firmata working fine on an Arduino Uno, communicating over cable USB to
I have an Arduino-based device which connects through USB. I'd like to detect it
I have a micro-controller (Arduino) and wish to determine automatically to which port the
I am trying to read serial data from an Arduino project, and I was
I have the following code on my Arduino that constantly checks for a serial
I have a constructor for my Arduino-code which is something like the following: class
I have written a program in C which communicates through udp with an Arduino.
I am fetching data from the following database: I have arduino-box that send that
Currently our application connects to an Arduino over a serial port. We send some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.