Un boton controla la luz

Un boton controla la luz

Un boton controla la luz


  1. WHAT YOU NEED
  2. LED - button - 4 wires
2CHALLENGE

####Connect an LED and a button to the Calliope mini. When you press the button, the LED lights up. When you release it, the LED turns off again.

3SOLUTION

###Code

Note: This program code is nested. The parameter block "digital read pin P1" is executed first and the result (state of the pushbutton) is transferred to the block "digital write pin P2", which switches the LED on or off.

Electronics

LED (+/-)!

  • short leg: GND (-)
  • long leg: analog output (P2)Button
  • outer leg: digital input (P1)
  • outer leg: VCC (+)

Share This

Comments

Visite nuestra sección de pedidos. (Desde el 1 de abril de 2020)