Pimoroni Tiny2040 turns a vibration motor ON and OFF

Description: A vibration motor alternates turning ON and OFF for 1 second with a Pimoroni Tiny 2040.

Pimoroni Tiny2040 turns ON and OFF a vibration motor

Notes: To prevent back EMF, a 1N4004 Rectifer Diode is placed between the motor and the pins. The onboard RGB LED appears to be illuminating by default, and can be turned off by putting the pins 20, 19, and 18 to HIGH.

Supplies:

1 – Breadboard 400 Points
1 – Pimoroni Tiny 2040
1 – 1N4004 Rectifier Diode   >> Link <<  
1 – Vibration Motor 1.5-3V 8000-16000RPM   >> Link <<

Arduino Code:

#define motor A2

void setup() {

  pinMode(motor, OUTPUT);

  // Onboard RGB LED Pins
  pinMode(20, OUTPUT);
  pinMode(19, OUTPUT);
  pinMode(18, OUTPUT);

  // Turns OFF the onboard RGB LED
  digitalWrite(20, HIGH);
  digitalWrite(19, HIGH);
  digitalWrite(18, HIGH);

}

void loop() {

  digitalWrite(motor, HIGH);
  delay(1000);
  digitalWrite(motor, LOW);
  delay(1000);

}

Leave a Comment

7 + 1 =