This sample code shows you how to turn on and off the vibration motor.
#define VMPIN 5 //Vibration motor pin
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(VMPIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(VMPIN, HIGH); // turn the Motor on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(VMPIN, LOW); // turn the Motor off by making the voltage LOW
delay(1000); // wait for a second
}
Page last edited March 08, 2024
Text editor powered by tinymce.