Audio output
in
Contributed Library Questions
•
1 year ago
Hi,
I am making a robot for my school project. (on a very low budget)
I have to control 2 motors (forward and reverse), and a servo.
I am trying to use a laptop to send audio signal with a Xbox 360 controller to the Bluetooth head set. Then read the signal with Arduino to control the motors and servo.
I am making a robot for my school project. (on a very low budget)
I have to control 2 motors (forward and reverse), and a servo.
I am trying to use a laptop to send audio signal with a Xbox 360 controller to the Bluetooth head set. Then read the signal with Arduino to control the motors and servo.
I am working on the Processing/laptop end right now, this is what I got so far:
import processing.opengl.*;import procontroll.*;import net.java.games.input.*;import arb.soundcipher.*;
ControllIO controllIO;ControllDevice xbox;ControllSlider leftslider;ControllSlider rightslider;ControllSlider trigger;
SoundCipher sc = new SoundCipher(this);
void setup() {controllIO = ControllIO.getInstance(this);
xbox = controllIO.getDevice("Controller (XBOX360 GAMEPAD)");
leftslider = xbox.getSlider(0);leftslider.setMultiplier(25);
rightslider = xbox.getSlider(2);rightslider.setMultiplier(25);
trigger = xbox.getSlider(4);trigger.setMultiplier(25);}
void draw () {sc.playNote(150, 100, .5); //markerprintln("150");delay(100);float l = leftslider.getValue();sc.playNote(50 + l, 100, .5);println(50 + l);delay(100);float r = rightslider.getValue();sc.playNote(50 + r, 100, .5);println(50 + r);delay(100);float t = trigger.getValue();sc.playNote(50 + t, 100, .5);println(50 + t);delay(100);}
It is working almost perfect. I just need to adjust the delay down a little. This is when the problem comes in. The programs freeze some times for a little. I am thinking it is because of the
soundcipher. Is there is easier/more efficient way to generate the sound? And any input on the entire project will be helpful, think it will work?
Thanks
1