Microswitch – 2 pieces

(25 customer reviews)

$4.90

13 in stock

Description

5V DC Relay Module Code


/* switch
 * 
 * Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
 * press), the output pin is toggled from LOW to HIGH or HIGH to LOW.  There's
 * a minimum delay between toggles to debounce the circuit (i.e. to ignore
 * noise).  
 *
 * David A. Mellis
 * 21 November 2006
 */
 
int inPin = 2;         // the number of the input pin
int outPin = 13;       // the number of the output pin

int state = HIGH;      // the current state of the output pin
int reading;           // the current reading from the input pin
int previous = LOW;    // the previous reading from the input pin

// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0;         // the last time the output pin was toggled
long debounce = 200;   // the debounce time, increase if the output flickers

void setup()
{
  pinMode(inPin, INPUT);
  pinMode(outPin, OUTPUT);
}

void loop()
{
  reading = digitalRead(inPin);

  // if the input just went from LOW and HIGH and we've waited long enough
  // to ignore any noise on the circuit, toggle the output pin and remember
  // the time
  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
    if (state == HIGH)
      state = LOW;
    else
      state = HIGH;

    time = millis();    
  }

  digitalWrite(outPin, state);

  previous = reading;
}

 

  1. Mdapdk

    buy atorvastatin 40mg online cheap order lipitor 20mg generic buy atorvastatin 20mg for sale

  2. Jijwdn

    buy cheap cipro – purchase bactrim generic buy augmentin generic

  3. Fglzai

    order cipro 1000mg – buy trimethoprim tablets brand amoxiclav

  4. Booqhi

    flagyl 400mg sale – purchase amoxil for sale zithromax 500mg us

  5. Lxaged

    purchase ciprofloxacin – erythromycin 500mg sale erythromycin over the counter

  6. Izeeil

    brand valacyclovir – cheap zovirax 800mg acyclovir ca

  7. Vhjwsv

    stromectola online – buy aczone medication buy tetracycline without a prescription

  8. Epzvok

    buy metronidazole pills – order cefaclor 500mg sale azithromycin generic

  9. Jvlyvb

    order ampicillin pill monodox ca purchase amoxil generic

  10. Jtvlid

    lasix 40mg for sale – brand lasix buy generic captopril 25 mg

  11. Iqcujn

    brand metformin 500mg – buy trimethoprim sale lincocin drug

  12. Nmvipq

    retrovir tubes – buy zyloprim 100mg generic

  13. Taxnvh

    clozaril 50mg pill – perindopril 4mg without prescription famotidine 20mg price

  14. Npazzs

    buy quetiapine – order luvox pills eskalith sale

  15. Alqxtw

    buy clomipramine 50mg generic – mirtazapine 15mg ca brand sinequan 25mg

  16. Epevoy

    order atarax 10mg sale – generic buspirone amitriptyline 25mg oral

  17. Pzjtan

    brand amoxicillin – erythromycin brand order ciprofloxacin for sale

  18. Dcwups

    clindamycin pills – cefpodoxime 200mg brand purchase chloromycetin pill

  19. Ufdkvj

    ivermectin 6mg online – brand aczone buy cefaclor sale

  20. Kcjjga

    ventolin 2mg tablet – purchase albuterol pill buy theo-24 Cr 400mg

  21. Tphttp

    methylprednisolone pill – cost loratadine 10mg azelastine 10ml sprayer

  22. Zlmmpo

    order desloratadine 5mg sale – triamcinolone cost buy cheap ventolin

  23. Slamad

    micronase order – order glyburide 2.5mg generic order forxiga online

  24. Oqxdtk

    order metformin 500mg generic – order cozaar 25mg pill buy precose paypal

  25. Ievizb

    prandin without prescription – buy repaglinide 1mg pills jardiance pills

Add a review

Your email address will not be published. Required fields are marked *