Arduino project- print -


#include <ps2keyboard.h>   const int buttonpin = 4;  int buttonstate = 0;   void setup() {    pinmode (buttonpin, output);   serial.begin(9600);  }  void loop() {    buttonstate = digitalread(buttonpin); if (buttonstate == high) {   serial.print("\t");   serial.println("in");  }  } 

i want print in, keeps repeating in many times.

maybe pressing button longer, want loop run once.

my suggestion add delay code after serial.print("storage");, so:

  buttonstate = digitalread(buttonpin);   if (buttonstate == high) {     serial.print("\t");     serial.println("storage");     delay(500);   } } 

what suspect happening when push button quickly, void loop goes through number of times. fix that, add delay of whatever time amount need, if press button, have time let go before code starts looping again.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -