Show Posts
Pages: 1 ... 45 46 [47] 48 49 ... 231
691  Using Arduino / Project Guidance / Re: Robot wireless mode select on: March 15, 2014, 08:08:42 pm
Quote
Thanks, this is just what i need, now does the transmitter keep transmitting the last button that was pressed or do i need to hold down the button to keep transmitting the signal?
It should be, you press it and it sends a signal then once you let go, the signal stops sending.

Quote
Also I'm already using the 5V pin on my arduino for the ultrasonic sensor so do i hook the receiver up in series or parallel with the ultra sonic sensor.
I do not know the power requirements of the receiver, but the 5V pin should be enough to power both.

Quote
Also one final question the out put pins D0, D1, D2, and D3 on the receiver go the the digital pins on the arduino not the analog pins, right?
Either or, analog pins can work as digital pins, but digital pins cannot read analog signals. They can only produce PWM signals, which are digital representations of an analog signal.
692  Using Arduino / Programming Questions / Re: Interrupt problem on: March 15, 2014, 03:59:17 pm
How is it wired, can you provide a circuit diagram or schematic? Are you using pull down resistors?
Also if you are unaware, the zero in attachInterrupt(0, lifeReduction, RISING); does not mean pin 0, it is pin 2. And this will need a pull down resistor.
693  Using Arduino / Project Guidance / Re: Robot wireless mode select on: March 15, 2014, 03:41:08 pm
If it is something as simple as a toggle switch, then you may want to get one of these. It still might be a little over kill, but four buttons should allow you to add more features than just follow and stay. 315MHz Wireless remote + receiver
694  Development / Other Software Development / Re: Can´t download arduino libraries on: March 15, 2014, 03:31:42 pm
Your post does not belong here in this section, it should be in Project guidance. Actually based on your issue, this isn't an Arduino related problem, its your computers problem so you may want to update it or get it fixed.

I don't know what OS your computer has or why it wont start the download, but if you hold CTRL when you click the download link, it may start. LiquidCrystal

There is one thing you will need to change in the liquidCrystal.h file, and thats this line. #include "Wprogram.h". This line must be changed to #include "Arduino.h", otherwise the library will not work. You can use a regular text editor like notepad or word pad. Just change that one line, then save it. NOT SAVE AS, just save.
695  Development / Other Software Development / Re: New Password Library on: March 15, 2014, 01:28:57 pm
Update!

I've been going through all my past libraries and I decided to add some more things to this library. I  added a few new features, that I think many will enjoy.

Let me know what you think.
696  Using Arduino / Programming Questions / Re: Help with 433 Receiver code on: March 15, 2014, 12:14:53 am
I'm not sure what led you this,
Quote
if (vw_get_message(message, &messageLength)  == 1){
 Serial.println("button: ONE");
}
else if (vw_get_message(message, &messageLength)  == 2){
 Serial.println("button: Two");
}
else if (vw_get_message(message, &messageLength)  == 3){
 Serial.println("button: Three");
}
else if (vw_get_message(message, &messageLength)  == 4){
 Serial.println("button: Four");
}
else if (vw_get_message(message, &messageLength)  == 5){
 Serial.println("button: Five");
}
else if (vw_get_message(message, &messageLength)  == 6){
 Serial.println("button: Six");
}
The reason you always see button: One, is because vw_get_message(uint8_t* buf, uint8_t* len) returns TRUE or 1 if there is a message and 0 if there is not.

But I can tell you that you want to be checking message[0] instead of vw_get_message(message, &messageLength). You know your going to get a value between 1 - 6, so you can use case statements to show what button was pressed.
697  Using Arduino / Programming Questions / Re: Display messages on TFT instead of serial monitor on: March 14, 2014, 09:21:48 pm
If you are also interested in making the screen have more features like buttons, Henning also has a button library, UTFT_Buttons.

I also made an extension library for the UTFT and UTouch libraries, which is similar to UTFT_Buttons, but it has a lot more to it.
Take a look, TFT_Extension, updated library at the bottom of page.
698  Using Arduino / Project Guidance / Re: Skip subroutine on: March 13, 2014, 09:13:36 pm
Can you post the code. Make sure it is in code tags, its the # above the smiley faces. [ code ] ... [/ code ]
699  Using Arduino / Project Guidance / Re: Steering Wheel Controls on: March 13, 2014, 09:12:11 pm
Have you made the circuit yet?

You would need to test each button and record the value it produces, then make a table of the recorded values. You can use an array for that. Once you have the array, you would need to cycle through the array and compare the read value to the recorded value. Make sure you give it some slack, say +- 3 from the recorded value. You can use a FOR loop to cycle through the values and if the read value is equal to or within the +- 3 range, return or do a particular function.

700  Using Arduino / Programming Questions / Re: End a Statement if a Button is Pressed? on: March 13, 2014, 05:18:21 pm
This will not let you see anything on the Serial monitor, Serial.begin(9200); but 9600 will.

He doesn't really need to use interrupts, but what he can do is use a simple timer and some case statements.
Something like this. NOTE: You need to put timer and Inc_Case at the top of your code. timer is unsigned long, and Inc_Case is int.

Code:
if( millis() - timer >= 500)
{
  timer = millis();
  Inc_Case > 3 ? Inc_Case = 0 : Inc_Case++; // condensed IF/ELSE statement.
  switch(Inc_Case)
  {
     case 0:
         digitalWrite(relayPin1, HIGH);           // turn Relay 1 on
         Serial.println("Button Pressed!");
         lcd.clear();
         lcd.print("Cannon 1 Fired!");
         Serial.println("Relay 1 ON");
         break;
   
     case 1:
         digitalWrite(relayPin2, HIGH);
         lcd.clear();
         lcd.print("Cannon 2 Fired!");
         Serial.println("Relay 2 ON");
         break;

     case 2:
         digitalWrite(relayPin3, HIGH);
         lcd.clear();
         lcd.print("Cannon 3 Fired!");
         Serial.println("Relay 3 ON");
         break;

    case 3:
        lcd.clear();
        lcd.print("Cannons Fired!");
        Serial.println("ALL relays ON!");
        break;
  }
}

Now you can do that same thing for your else statement, but instead of 500, it's 900.
701  Using Arduino / Programming Questions / Re: Problem debouncing multiple buttons on: March 13, 2014, 05:06:52 pm
There are a few things you should fix. For starters, all of these:
Quote
actionstate=timecheck(125, 0);  
    if(actionstate==1)
You can condense these to just if( timecheck(125, 0) )  

Another thing is your debounce function should return something. You can change this to have a boolean variable and return the state  of that variable.
Quote
int debounce(int buttonNumber) //recieves a pin and debounces that pin
{
   static boolean ButtonOut = false;

  reading[buttonNumber] = digitalRead(buttonPin[buttonNumber]);
  if (reading[buttonNumber] != lastButtonState[buttonNumber])
  {
    lastDebounceTime[buttonNumber] = millis();
  }

  if ((millis() - lastDebounceTime[buttonNumber]) > debounceDelay[buttonNumber])
  {
    if (reading[buttonNumber] != buttonState[buttonNumber])
    {
      buttonState[buttonNumber] = reading[buttonNumber];

      if (buttonState[buttonNumber] == LOW)
      {
        ledState = !ledState;
        //buttonlook[buttonNumber]=1;        //changes variable to 1 to be later tested if true
        ButtonOut = true;   // if at any time one of the buttons is LOW, it will set the variable TRUE
        

      }
    }
  }

  // set the LED:
  digitalWrite(ledPin13, ledState);// lights the LED so you know button was pressed

  // save the reading.  Next time through the loop,
  // it'll be the lastButtonState:
  lastButtonState[buttonNumber] = reading[buttonNumber];

 return ButtonOut; // will return false if no button is LOW and will return true if one of them is
}

Now once that is changed, you can do this as well.
Code:

    if(debounce(buttonNumber[i]) ) //debounces input pins, loops through all the pins
    {
      switch(i)
702  Using Arduino / Project Guidance / Re: LCD with Custom Push Buttons on: March 13, 2014, 03:48:54 am
Have you tried to incorporate the menu library which can be found in the arduino playground?
703  Using Arduino / Programming Questions / Re: Problem debouncing multiple buttons on: March 13, 2014, 02:32:25 am
Could you attach a picture of what your seeing on your GLCD?
704  Using Arduino / Programming Questions / Re: Problem debouncing multiple buttons on: March 13, 2014, 12:22:15 am
Something in here is backwards. Adding some spaces may help you find the problem.
Quote
for(int i=0; i>99; i++){
    previousMillis[ i ]=0;
  }
705  Using Arduino / Programming Questions / Re: Trying to run an "If" statement only once on: March 13, 2014, 12:16:35 am
You already wrote the answer to your question in another statement.

Quote
else if (buttonState == 0 && lastButtonState == 1 && blinking == true){ // all three conditions must be TRUE to enter this statement, so what happens if one is initially true, then gets set to false without setting it back to true?
   blinking = false;                                    // turn off blinking, all done timing
   lastButtonState = buttonState;                       // store buttonState in lastButtonState, to compare next time
Pages: 1 ... 45 46 [47] 48 49 ... 231