Show Posts
|
|
Pages: [1]
|
|
1
|
Using Arduino / Audio / Re: Seeed Music Audio Shield
|
on: January 14, 2013, 10:31:46 am
|
|
Hi there,
I'd be interested to know which libraries and code you used to make it work just to play mp3's, and on what arduino board. Did you have any other problems?
best, g
|
|
|
|
|
2
|
Using Arduino / Sensors / Re: N00b: pausing a loop
|
on: November 16, 2012, 10:31:38 am
|
Hi, thanks for the tip. I understand the concept, but I still get the same result, the light blinking at the interval. And even stranger to me, is the output printed, this is without touching the switch at all: (first int is the previous value of 'val', second is 'val' as gotten fresh from the digital input, third is the updated 'previousVal' as 'val') Ready 1 0 0 writing HIGH 0 1 1 writing LOW 1 0 0 writing HIGH 0 1 1 writing LOW 1 0 0 writing HIGH 0 1 1 writing LOW 1 0 0 writing HIGH 0 1 1 writing LOW 1 0 0 writing HIGH 0 1 1 writing LOW 1 0 0 ..... and so on. Heres my updated code: #include <Servo.h> Servo servoMain; // Define our Servo
int ledPin = 13; // choose the pin for the LED int inPin = 9; // choose the input pin (for a pushbutton) int val = 0; // variable for reading the pin status int previousVal= 1;
long previousMillis = 0; // will store last time LED was updated // the follow variables is a long because the time, measured in miliseconds, // will quickly become a bigger number than can be stored in an int. long interval = 2000; // interval at which to blink (milliseconds)
void setup() { pinMode(ledPin, OUTPUT); // declare LED as output pinMode(inPin, INPUT); // declare pushbutton as input servoMain.attach(5); // servo on digital pin 5 Serial.begin(9600); //Start Serial Communications with PC Serial.println("Ready"); }
void loop(){ unsigned long currentMillis = millis(); if(currentMillis - previousMillis > interval) { // save the last time you blinked the LED val = digitalRead(inPin); // read input value if (val != previousVal) { Serial.println(previousVal); Serial.println(val); previousVal= val; Serial.println(previousVal); if (val == LOW) { // check if the input is HIGH (button released) digitalWrite(ledPin, HIGH); // turn LED OFF // Run Servo //servoMain.write(45); Serial.println("writing HIGH"); previousMillis = currentMillis;
} else { digitalWrite(ledPin, LOW); // turn LED ON
// Run Servo //servoMain.write(0); Serial.println("writing LOW"); } } } }
|
|
|
|
|
3
|
Using Arduino / Sensors / N00b: pausing a loop
|
on: November 15, 2012, 03:39:55 pm
|
Hi all, I'm quite fresh with arduino, and haven't seen a tutorial covering this. I'm trying to make a switch trigger a servo in the way that it would move it (and turn on the LED at pin 13) and then ignore if the switch turns on or off for a certain amount of time, here 2 seconds. I thought I would achieve this by inserting a delay(2000) after it reads the pin as being HIGH, but this results in the LED at pin 13 blinking at a 2 second interval. Any hints are greatly appreciated! In the end I would like to make the switch trigger a soundfile on the seeduino music shield, and ignore any switch changes until the soundfile has finished... #include <Servo.h> Servo servoMain; // Define our Servo
int ledPin = 13; // choose the pin for the LED int inPin = 8; // choose the input pin (for a pushbutton) int val = 0; // variable for reading the pin status int reset= 0; // var to not send out to many messages to servo
void setup() { pinMode(ledPin, OUTPUT); // declare LED as output pinMode(inPin, INPUT); // declare pushbutton as input servoMain.attach(5); // servo on digital pin 5 Serial.println("Ready"); }
void loop(){ val = digitalRead(inPin); // read input value if (val == HIGH) { // check if the input is HIGH (button released) digitalWrite(ledPin, LOW); // turn LED OFF // Run Servo servoMain.write(45); delay(2000); reset= 0;
} else { digitalWrite(ledPin, HIGH); // turn LED ON if (reset == 0) { // Run Servo servoMain.write(0); } reset= 1; } }
|
|
|
|
|
4
|
Forum 2005-2010 (read only) / Interfacing / Re: Can somebody test my new Trackpad library?
|
on: September 18, 2010, 09:35:58 am
|
Hi, now I'm trying to expand to using two touchpads, but I'm having a problem differentiating between the values of the two. I made a try in the code below but SuperCollider, which Im using to interpret the values, is sometimes mixing them up. By dumping "first" and "second" before the values from the respective touchpad I route the coming values in SuperCollider to control two different objects.. What would be ideal is to be able to send a DUMP with a different name than "packet->x", like "packet->x2" (or a name I write) for the second touchpad, then I can easily grab it in SuperCollider. so, this is how my loop{} looks now: void loop() { static packet_t oldPacket; static packet_t oldPacket2; packet_t * packet; packet = t.getNewPacket();
if(!packetsEqual(&oldPacket, packet)) { DUMP("first"); DUMP(packet->x); DUMP(packet->y); //DUMP(packet->z); //DUMP(packet->w); DUMP(packet->leftButtonDown); DUMP(packet->rightButtonDown);
Serial.print("\n"); #if ANSI_TERMINAL Serial.print(0x1B,BYTE); Serial.print("[H"); #endif Serial.print("\n"); // copy the current packet oldPacket = *packet; }
packet = t2.getNewPacket();
if(!packetsEqual(&oldPacket2, packet)) { DUMP("second"); DUMP(packet->x); DUMP(packet->y); //DUMP(packet->z); //DUMP(packet->w); DUMP(packet->leftButtonDown); DUMP(packet->rightButtonDown);
Serial.print("\n"); #if ANSI_TERMINAL Serial.print(0x1B,BYTE); Serial.print("[H"); #endif Serial.print("\n"); // copy the current packet oldPacket2 = *packet; } }
cheers! g
|
|
|
|
|
7
|
Forum 2005-2010 (read only) / Interfacing / Re: Can somebody test my new Trackpad library?
|
on: August 19, 2010, 05:55:13 am
|
Thank you! Worked just like that, and I have never really gotten my fingers into C or C++ or whatever code that was before  I put the modified library on the wiki ( http://www.arduino.cc/playground/Main/Trackpad) as I cant find a way to attach it here. I have another question, please excuse me if its a bit of a noob question not specific to your lib. How can I make the code in Trackpad_print.pde only send out values when they change? There are probably standards for doing this so I only need where to look for answers maybe. again, thanks for the nice lib! g
|
|
|
|
|
11
|
Forum 2005-2010 (read only) / Interfacing / reading CV from volume pedal
|
on: November 28, 2008, 12:41:16 pm
|
|
Hi!
Does anyone know how to read CV (control voltage) from a expression/volume pedal (ex behringer fcv100)? Connecting a jack cable to the output of the pedal and then the tip to analog in and the ring to 3/5v on the arduino gives no result.
This is what the specs sheet on the pedal says: input/output: 1/4" TS connectors, unbalanced Tip: Supply voltage from unit/instrument to be controlled (Impedance: 50 k[ch937]) Ring: Slider pick-up (control voltage dependend on pedal position (Impedance: 0...50 k[ch937])
Sorry if this is very basic - I couldnt find any info on it when searching.. Any help is highly appreciated!
Thanks! Martin
|
|
|
|
|
12
|
Forum 2005-2010 (read only) / Exhibition / Re: Touchpad Midi
|
on: August 18, 2010, 03:45:24 pm
|
@antima55: the wiring is different on more or less every touchpad. I had to experiment for about 40min to find the right one for my touchpad 135227-001, which btw is: black= 5v orange= gnd red= 6 brown= 5 (it searched for it and it gave no answers) good luck! its not at all tricky, just takes some time 
|
|
|
|
|