Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Interfacing / Re: Press a button on arduino to open a file? on: April 27, 2009, 07:17:00 pm
Its working perfectly! hopefully this will be my final question for you guys. I want to set up 2 keyed switches at opposite ends of the room so there must be at least 2 people there to activate the highest party mode. how do i set up a timer so when it senses that both inputs go high within 1 second it activates the final level?
Thanks very much for your help you have been very informative.
Demir
2  Forum 2005-2010 (read only) / Interfacing / Re: Press a button on arduino to open a file? on: April 21, 2009, 10:53:27 pm
i have 3 switches set up to select the level 1,2 and 3. when the big red button is pressed that sends the level to gobetwino and it opens the playlist i want. The only problem i have now is that the "vallev" in my code is always "0" zero. how would i fix that? I am very sorry for the simple questions.
thanks
demir

Code:
/*
 * Emergency Party Button
 * Sends serial commands to the program gobetwino through serial port
 */
 
int inputPin1 = 5;               // sets the input pins
int inputPin2 = 6;
int inputPin3 = 7;
int inputPin4 = 8;
int vallev=0;                    //stores level value
int val = 0;                    // variable for reading the pin status

void setup() {
  Serial.begin(9600);
  pinMode(inputPin1, INPUT);     // declares pushbuttons as input
  pinMode(inputPin2, INPUT);
  pinMode(inputPin3, INPUT);
  pinMode(inputPin4, INPUT);
}

void loop(){
  val = digitalRead(inputPin1);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
  vallev == 1;                   // send to vallev
  delay(1000);                  // delay to limit to 1 value per button press
  }
  val = digitalRead(inputPin2);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
  vallev == 2;                   // send to vallev
  delay(1000);                  // delay to limit to 1 value per button press
  }
  val = digitalRead(inputPin3);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
  vallev == 3;                   // send to vallev
  delay(1000);                  // delay to limit to 1 value per button press
  }
  
  val = digitalRead(inputPin4);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
  Serial.print("#S|LEVEL");  // send command by serial port
  Serial.print(vallev);
  Serial.println("|[]#");    // Gobetwino intperets this as a single line
                            //looking like this "#S|LEVEL(vallev)|[]#"
  delay(1000);
  }
}

3  Forum 2005-2010 (read only) / Interfacing / Re: Press a button on arduino to open a file? on: April 19, 2009, 01:23:24 pm
Here is the current code. It is working perfectly. I only have 1 switch set up so far. how do i get the arduino to stop sending the string after the delay in the loop? i want to be able to leave the switch on but if i do the loop sends the command again and winamp starts playing the song from the beginning.
Code:
/*
 * Emergency Party Button
 * Sends serial commands to the program gobetwino through serial port
 */
 
int inputPin1 = 5;               // sets the input pins
int inputPin2 = 6;
int inputPin3 = 7;
int inputPin4 = 8;
int val = 0;                    // variable for reading the pin status

void setup() {
  Serial.begin(9600);
  pinMode(inputPin1, INPUT);     // declares pushbuttons as input
  pinMode(inputPin2, INPUT);
  pinMode(inputPin3, INPUT);
  pinMode(inputPin4, INPUT);
}

void loop(){
  val = digitalRead(inputPin3);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    Serial.println("#S|LEVEL1|[]#");  // send command by serial port
  delay(1000);
  }
}

4  Forum 2005-2010 (read only) / Interfacing / Re: Press a button on arduino to open a file? on: April 18, 2009, 07:41:07 pm
this is the current code i have. it sends the string to gobetwino when i press the button.but i get this error "The string recieved : 12345 is not a well formed command string" How would i fix that? also because i am using the delay at the end of the loop if i leave the toggle switch on it will send the string again after the delay. i am very sorry i am new to this im sure these are pretty easy questions for you guys. is there a good site i can go to to learn how to program better?
thanks
demir

Code:
/*
 * Emergency Party Button
 * Sends serial commands to the program gobetwino through serial port
 */
 
int inputPin1 = 5;               // sets the input pins
int inputPin2 = 6;
int inputPin3 = 7;
int inputPin4 = 8;
int val = 0;                    // variable for reading the pin status

void setup() {
  Serial.begin(9600);
  pinMode(inputPin1, INPUT);     // declares pushbuttons as input
  pinMode(inputPin2, INPUT);
  pinMode(inputPin3, INPUT);
  pinMode(inputPin4, INPUT);
}

void loop(){
  val = digitalRead(inputPin3);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    Serial.println("12345");  // send command by serial port
  delay(1000);
  }
}

5  Forum 2005-2010 (read only) / Interfacing / Re: Press a button on arduino to open a file? on: April 17, 2009, 05:07:17 pm
The first 3 inputs will be toggle switches, and the last will be a big red emergency stop button. they will be constantly on. they are connected like in the push button example on the arduino site with a pull up resistor.  http://www.arduino.cc/en/Tutorial/Button . I was also thinking about adding 2 keyed switches so there has to be at least 2 people to activate the highest level of "party mode" how would i program in a timmer so both keys must be turned within a second of each other? thanks very much for the help. if i could find some similar examples i could piece parts of code together but i am having difficulty finding what i need.
thanks
demir
6  Forum 2005-2010 (read only) / Interfacing / Re: Press a button on arduino to open a file? on: April 16, 2009, 07:46:55 pm
I like the way gobetwino works. but i am having trouble setting up the code on my arduino. I am trying to make an Emergency Party Button
I am trying to set up the 3 switches to select what "level" the party should be. then by pressing the pushbutton switch sends the "level" by serial port to gobetwino which opens the playlist file i want to play.
this is the code i have so far i am new to programming i have some understanding but not much. so far the code i have just repeats the string "level1" over and over. how would i get it to stop after sending the string once? any help would be very appreciated.
Thanks

demir



Code:
/*
 * Emergency Party Button
 * Sends serial commands to the program gobetwino through serial port
 */
 
int inputPin1 = 5;               // sets the input pins
int inputPin2 = 6;
int inputPin3 = 7;
int inputPin4 = 8;
int val = 0;                    // variable for reading the pin status

void setup() {
  Serial.begin(9600);
  pinMode(inputPin1, INPUT);     // declares switches as input
  pinMode(inputPin2, INPUT);
  pinMode(inputPin3, INPUT);
  pinMode(inputPin4, INPUT);     // declares pushbutton as input
}

void loop(){
  val = digitalRead(inputPin1);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    Serial.println("LEVEL1");  // send command by serial port
  } else {
    
  }
}
7  Forum 2005-2010 (read only) / Interfacing / Press a button on arduino to open a file? on: April 15, 2009, 06:18:08 pm
Is it possible to have "processing" or another program monitor the serial port for when I press a button connected to an arduino to open a file and when i press another button to open another file? i am trying to get winamp to open different playlists for what button I press. If I can have the program make the computer think i double clicked on the playlist, winamp will automatically open it. I am using windows xp.
Thank you very much
Demir
8  Forum 2005-2010 (read only) / Interfacing / Re: reading rpm signal from cpu fan on: March 01, 2009, 02:54:34 pm
Can someone please post how to connect the RPM wire properly to an arduino duemilanove. I have seen some fuzzy pictures that show a resistor and a led but no description of how to connect them to the arduino. I want to try and get a fan to act as a POV like the harddrive POV.
thanks
demir57
Pages: [1]