Botão de Pressão para PCB 5mm
  • Botão de Pressão para PCB 5mm
  • Botão de Pressão para PCB 5mm

Botão de Pressão para PCB 6x6mm

:CEL10014
0,15 €
preço com IVA incluído

Pulsor para montagem em PCB 6x6mm, max. 50mA/24V, extensão(upthrow) 0,5mm, pressão de activação 1,6N.

Quantidade

DESCRIÇÃO EM PORTUGUÊS BREVEMENTE DISPONÍVEL

Se tiver alguma dúvida neste produto não hesite em contactar-nos.

*Atenção: as imagens são meramente ilustrativas.

/* Learn to use pushbutton (button switch) with Arduino - Tutorial
   More info and circuit schematic: http://www.ardumotive.com/arduino-tutorials/category/button
   Dev: Michalis Vasilakis / Date: 19/10/2014  
   UPDATED 2/6/2016 - LED to Arduino pin 3 and button to Arduino pin 4*/


//Constants
const int buttonPin = 4;     
const int ledPin =  3;     

//Variables
int buttonState = 0;
int flag=0;

void setup() {
  //Input or output?
  pinMode(ledPin, OUTPUT);      
  pinMode(buttonPin, INPUT_PULLUP);   
}

void loop(){
  //Read button state (pressed or not pressed?)
  buttonState = digitalRead(buttonPin);

  //If button pressed...
  if (buttonState == LOW) { 
    //...ones, turn led on!
    if ( flag == 0){
      digitalWrite(ledPin, HIGH);
      flag=1; //change flag variable
    }
    //...twice, turn led off!
    else if ( flag == 1){
      digitalWrite(ledPin, LOW);
      flag=0; //change flag variable again 
    }    
  }
  delay(200); //Small delay

}

esquema

 

CEL10014

Downloads

KSM612B.png

Downloads (31.72k)

Também poderá gostar