Micro Slide Switch turns LED ON/OFF with Nerdonic Exen Mini

Description: A micro slide switch turns six LEDs ON/OFF. No resistor is needed, since with a resistor either not LEDs would turn ON or they would be dimly lit due to not enough power from the Nerdonic Exen Mini.

Slide Switch contorls LEDs with Nerdonic Exen Mini


1 –  Breadboard 400 Points
1 – Nerdonic Exen Mini
6 – LED
1 – Micro Slide Switch

Arduino Code:

#define switch SCL
#define led SDA
#define led2 0
#define led3 1
#define led4 A2
#define led5 A3
#define led6 A4

int switchState = 0;

void setup() {

  pinMode(switch, INPUT_PULLUP);
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);


void loop() {

switchState = digitalRead(switch);

if (switchState == LOW) {

  digitalWrite(led, HIGH);
  digitalWrite(led2, HIGH);
  digitalWrite(led3, HIGH);
  digitalWrite(led4, HIGH);
  digitalWrite(led5, HIGH);
  digitalWrite(led6, HIGH);




  digitalWrite(led, LOW);
  digitalWrite(led2, LOW);
  digitalWrite(led3, LOW);
  digitalWrite(led4, LOW);
  digitalWrite(led5, LOW);
  digitalWrite(led6, LOW);

Leave a Comment

+ 62 = 69