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

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -