2

I have a Digispark Rev.3 Kickstarter with ATTiny85 (see pinout below) and a three pin slide switch (see example below). I want to use the slide switch to control a task running on the Digispark, with the example code below.

The center pin of the slide switch will be connected to GND, one pin will be soldered to pin 2 on the Digispark (pinMode(2, INPUT_PULLUP);) and the remaining pin will be unused.

To install the switch, I want to have the center pin of the switch go through P3 on the pinout, one pin through P2 (which will be addressed in the code) and the remaining pin through P4. This means, P3 will be soldered to GND and depending on the switches position, P2 or P4 will connect to GND as well.

Could these connections between P2, P3 or P4 and GND interfere with the functionality or damage the Digispark?

int switchPos;
void setup() {
  pinMode(2, INPUT_PULLUP);
}

void loop() { switchPos = digitalRead(2); if (sensorVal == HIGH) { runCode(); } else { delay(1000); } }

Digispark Rev.3 Kickstarter with ATTiny85 Three pin slide switch

emma.makes
  • 105
  • 6

1 Answers1

4

Yes, you will lose the USB connection, since PB3 and PB4 are used for the USB communication. Normally you wouldn't solder a component directly onto a board if it doesn't fit with all pins. Instead you would use wires or a breakout PCB to do the job.

If you really want to to that and you don't need any of the other pins, then you can use PB0 and PB1. Set PB1 to OUTPUT LOW and PB0 as input. The OUTPUT LOW is basically the same as ground and configuring a pin as INPUT will make it high resistance, so it doesn't interfere with the circuit.

jsotola
  • 1,554
  • 2
  • 12
  • 20
chrisl
  • 16,622
  • 2
  • 18
  • 27