Project Video
Project Details
This is the Arduino code to control control vibration motor with Arduino
See Trigger Vibration Motor module with Arduino and voltage from potentiometer Example 2/2
Project Code
/*
* Control vibration motor module using Arduino
*
* Written by Ahmad Shamshiri on June 26th 2019 at 22:07
* in Ajax, Ontario, Canada
* Visit www.Robojax.com for codes
* Watch video instruciton and demonstration:
* https://youtu.be/5wUxBjpXzL8
You can get the wiring diagram from my Arduino Course at Udemy.com
Learn Arduino step by step with all library, codes, wiring diagram all in one place
visit my course now http://robojax.com/L/?id=62
If you found this tutorial helpful, please support me so I can continue creating
content like this. You can support me on Patreon http://robojax.com/L/?id=63
or make donation using PayPal http://robojax.com/L/?id=64
*
* Code is available at http://robojax.com/learn/arduino
* This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.*
* This code has been download from Robojax.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#define vibOutPin 2
void setup() {
pinMode(vibOutPin,OUTPUT);// define a pin as output
}
void loop() {
digitalWrite(vibOutPin,HIGH);
delay(2000);
digitalWrite(vibOutPin, LOW);
delay(600);
digitalWrite(vibOutPin,HIGH);
delay(2000);
digitalWrite(vibOutPin, LOW);
delay(600);
digitalWrite(vibOutPin,HIGH);
delay(2000);
digitalWrite(vibOutPin, LOW);
delay(600);
delay(5000);
}// loop