I'm currently making some Drums for the game Clone Hero, and the Dolphin Emulator.
My problem is that I can't activate 2 Piezos at the same time. They work fine when I activate them alone but not 2 at the same time. I have a Arduino Pro Micro and use this library.
I'm really new to this whole Arduino thing, so I currently don't understand a ton.
Anyway, thanks in Advance.
#include <Joystick.h>
const int drum1 = A0;
const int drum2 = A1;
const int drum3 = A2;
const int drum4 = A3;
const int threshold = 100;
int sensorReading = 0;
Joystick_ Joystick;
void setup() {
// Initialize Joystick Library
Joystick.begin();
}
// Last state of the button
int lastButtonState = 0;
void loop() {
sensorReading = analogRead(drum1);
if (sensorReading >= threshold)
{
Joystick.pressButton(0);
Joystick.releaseButton(0);
}
sensorReading = analogRead(drum2);
if (sensorReading >= threshold)
{
Joystick.pressButton(1);
Joystick.releaseButton(1);
}
}