OSDYLS - Open Source DIY Lasertag System #4

Still waiting for a couple of things but some reed contacts arrived and already passed my first test, require a really tiny magnet to trigger, the resistor is a 10K in case you want to know: 

 

 


int led = BUILTIN_LED;     
int buttonio = D5;
int btn = 0;   

void setup() {
  pinMode(led, OUTPUT);   
  pinMode(buttonio, INPUT);
}
void loop() {
  btn = digitalRead(buttonio);
     if (btn == HIGH) {
        digitalWrite(led, HIGH);          
       }
     else {
        digitalWrite(led, LOW);
     }
}

Comments

Popular posts from this blog

OSDYLS - Open Source DIY Lasertag System #7 IR communication

OSDYLS - Open Source DIY Lasertag System #6 testing all components with the S2 mini