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 6346687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:04:01+00:00 2026-05-24T21:04:01+00:00

I have an Arduino sketch that reports data over the serial port when a

  • 0

I have an Arduino sketch that reports data over the serial port when a button is pressed on the board. What is reading the serial port is a Node.js server that has some interactions with the OS when the button is pressed.

The problem that I found first was that if I didn’t put a delay at the end of my loop was that the Node.js server would seem to bottleneck and start reading the next set of instructions before finishing the last set. Each loop always sends data over to the serial port.

Anyways I set my sketch to delay for 100 milliseconds at the end of each loop.

The problem that I found now is that if I hold the button down for more than that 100ms it sees it as 2 button presses and so the node.js code that runs on each button press gets doubled up. Is there a way that I can tell if the user pressing the button has released the press?

  • 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-24T21:04:02+00:00Added an answer on May 24, 2026 at 9:04 pm

    You need to add a software to debounce the switch.

    Depending on your app to might want an autorepeat or send a different
    code when the switch is released.

    If you only want one sent, you can add code like below:

        If (buttonpressed==TRUE)
        {
            If (buttonsent==FALSE)
            {
                sendbutton();
                buttonsent=TRUE;
            }
         }
         else
         {
             buttonsent=FALSE;
         }
    
    • 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 a Python script that writes data packets to an Arduino board through
I have a problem automagically detecting my Arduino's serial port in Python, using Mac/Linux.
I am fetching data from the following database: I have arduino-box that send that
I have a simple Arduino sketch that spans several files. There is a function
I have to connect the Arduino board I got with Java and get data
I have an Arduino sketch that takes a timet and when that timet is
I have an Arduino sketch that takes a timet and when that timet is
I'm trying to read serial data from my Arduino using Java. I have followed
I have an Arduino that is processing a string by splitting it into an

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.