Thanks Lowfer. It was a simple and fun project to do and one of the few that I still keep around and use to accompany my uke and guitar. Couldn't have done it though if I hadn't found the rhythm drum score for Wipeout.
Here is the code for Arduino Uno and two servos: #include // servo drummer Jim Demello June 2018 int beatParms[2] [100]; const int buttonPin = 13; // the number of the pushbutton pin int buttonState = 0; int buttonOn = 0; Servo myservo1,myservo2; int servoPin6 = 6; //servo int servoPin7 = 7; void myServo(int servoPosition, int servoNumber) { if (servoNumber == 1) { myservo1.write(servoPosition); } if (servoNumber == 2) { myservo2.write(servoPosition); } } void doOneEighthNote(int servoNumber,int beat, int delayVal) { //int delayVal = 60;
if (servoNumber == 1) { if (beat) {beat = 18; // if beat = 1 then add a little more servo down for stronger thump } myServo(150 + beat,servoNumber); //down delay(delayVal); myServo(100,servoNumber);//up delay(delayVal); }
if (servoNumber == 2) { if (beat) beat = -18; myServo(60 + beat,servoNumber); //down delay(delayVal); myServo(80,servoNumber);//up delay(delayVal); } }
void setup() { Serial.begin(9600); myservo1.attach(servoPin6, 1000, 2000); // attaches the servo on pin 9 to the servo object myservo1.write(100); myservo2.attach(servoPin7, 1000, 2000); // attaches the servo on pin 9 to the servo object myservo2.write(90); pinMode(buttonPin, INPUT_PULLUP); digitalWrite(buttonPin, HIGH); } ////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////// void loop() { buttonState = digitalRead(buttonPin); buttonState = HIGH; if (buttonState == HIGH && buttonOn == 0) { // if button high then start drum sequence // buttonOn = 1; //wipeout(); // wipeout drum routine if (random(1,3) == 1) fourQuarterTime2(); else fourQuarterTime(); //oneTime(); // delay(500); // delay some to give time to open button back up
} } /////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////// void oneTime() { while(1) { int beatParms[2][100] = {{1,2}, {0,0}}; // servo number and beat (1=beat,0=nobeat)
This is simple (yet, at the same time complex) but amazing
Thanks Lowfer. It was a simple and fun project to do and one of the few that I still keep around and use to accompany my uke and guitar. Couldn't have done it though if I hadn't found the rhythm drum score for Wipeout.
We really enjoyed that....
Thanks Cheryl. Hope you and Doug and family are well.
can we cahange the tune if yes how
Here is the code for Arduino Uno and two servos:
#include
// servo drummer Jim Demello June 2018
int beatParms[2] [100];
const int buttonPin = 13; // the number of the pushbutton pin
int buttonState = 0;
int buttonOn = 0;
Servo myservo1,myservo2;
int servoPin6 = 6; //servo
int servoPin7 = 7;
void myServo(int servoPosition, int servoNumber) {
if (servoNumber == 1) {
myservo1.write(servoPosition);
}
if (servoNumber == 2) {
myservo2.write(servoPosition);
}
}
void doOneEighthNote(int servoNumber,int beat, int delayVal) {
//int delayVal = 60;
if (servoNumber == 1) {
if (beat) {beat = 18; // if beat = 1 then add a little more servo down for stronger thump
}
myServo(150 + beat,servoNumber); //down
delay(delayVal);
myServo(100,servoNumber);//up
delay(delayVal);
}
if (servoNumber == 2) {
if (beat) beat = -18;
myServo(60 + beat,servoNumber); //down
delay(delayVal);
myServo(80,servoNumber);//up
delay(delayVal);
}
}
void setup()
{
Serial.begin(9600);
myservo1.attach(servoPin6, 1000, 2000); // attaches the servo on pin 9 to the servo object
myservo1.write(100);
myservo2.attach(servoPin7, 1000, 2000); // attaches the servo on pin 9 to the servo object
myservo2.write(90);
pinMode(buttonPin, INPUT_PULLUP);
digitalWrite(buttonPin, HIGH);
}
//////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
void loop() {
buttonState = digitalRead(buttonPin);
buttonState = HIGH;
if (buttonState == HIGH && buttonOn == 0) { // if button high then start drum sequence
// buttonOn = 1;
//wipeout(); // wipeout drum routine
if (random(1,3) == 1) fourQuarterTime2();
else fourQuarterTime();
//oneTime();
// delay(500); // delay some to give time to open button back up
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
void oneTime() {
while(1) {
int beatParms[2][100] = {{1,2}, {0,0}}; // servo number and beat (1=beat,0=nobeat)
for (int c=0;c
Hey at 1.5x speed they've really got it down
Thanks Jonathan, tried that and it sounds much better, still missing a beat here and there but that's an Arduino for ya.
Can you give me the python code of arduino ?
Thank you
Sorry, I don't do Python, just Arduino C++.
Can you give me the c++ code and the pin connections of the servo controllers
Details here: www.instructables.com/id/Arduino-Servo-Drum-Machine/
Jimmy Demello thank you
Have you made these for purchase?
No. It was just a oneoff. Besides I live in a foreign country with no shipping to USA. Would be a fun project for someone with a 3d printer.
please reply fast its urgent ok
email me circuit diagram and coding