Show Posts
Pages: 1 ... 65 66 [67] 68 69 ... 253
991  Using Arduino / Programming Questions / Re: Problem debouncing multiple buttons on: March 21, 2014, 05:03:14 pm
I dont have your LCD, so I can't do any tests to see why its not working.

Quote
I'm not sure what you are asking. The array buttonNumber[ i ] has the numbers 0-7 in it and never changes. The loop cycles through 0-7.
What I'm asking is why use an array with 0-7 in it, when you can just use the FOR loop that already cycles through 0-7. There is no difference of the 0-7 in the array to the 0-7 in the FOR loop, so why add in something that is not needed?
992  Using Arduino / Project Guidance / Re: NEED HELP! Stuck 4X3 keypad access code sketch on: March 21, 2014, 03:31:49 pm
If the library is in the correct spot then what arduino software version are you using? Make sure the Keypad.h file does not have WProgram.h in it, and if it does then you need to change it to Arduino.h and save it.

If you still get errors then you need to post pictures, screenshots of where the library is and the errors your getting. Make sure the pictures are a reasonable size, nothing like 2000x2000.
993  Using Arduino / Project Guidance / Re: NEED HELP! Stuck 4X3 keypad access code sketch on: March 21, 2014, 02:07:02 pm
Where did you put your library, lets start there. It should be in your MyDocuments as Arduino/libraries/Keypad. Make sure it is also not double foldered. "Keypad/Keypad"

Make sure your libraries are also up to date.
994  Using Arduino / Project Guidance / Re: NEED HELP! Stuck 4X3 keypad access code sketch on: March 21, 2014, 01:45:03 pm
I was able to compile the code above without errors, unless the code above was previously changed. If that is the original sketch, then the issue lies with your library.
995  Using Arduino / Programming Questions / Re: Cycling through three ultrasonic sensors? on: March 21, 2014, 04:45:12 am
There was far too many things wrong with your code and Im not going to spend hours going back and forth telling you what to add and change, so I did it myself. But just this one time to get you on the correct path.

Code:
#include <NewPing.h>

#define TRIGGER_PIN1  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN1     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define TRIGGER_PIN2  14  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN2     13  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define TRIGGER_PIN3  16  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN3     15  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 400 // Maximum distance we want to ping for (in centimeters).

NewPing sonar1(TRIGGER_PIN1, ECHO_PIN1, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
NewPing sonar2(TRIGGER_PIN2, ECHO_PIN2, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
NewPing sonar3(TRIGGER_PIN3, ECHO_PIN3, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

NewPing Sensors[3] = {sonar1, sonar2, sonar3}; // create an object array for your 3 sensors, DO NOT CHANGE

unsigned long currentTime;
unsigned long sonarTime = 0;
int convert;
unsigned int pingRx;
byte idx = 0;

void Sonic()
{
  currentTime = millis();
  if ((currentTime - sonarTime) > 300) // This is the better way to write it.
  {
    //lcd.clear();
    if( idx > 2) // This keeps idx within a range of 0 - 2 for the sensor array.
      idx = 0; // if idx is greater than 2, then reset it back to 0
    else
      idx++; // otherwise increment it by 1.

    sonarTime = currentTime;
  }

  // I chose to write the code this way so your sensors can get multiple pings within 300 milliseconds.
  // The more readings it is allowed to get, the better the results.

  // If you look below, this is how you would cycle through the multiple sensors, "Sensors[ idx ]".
  pingRx = Sensors[ idx ].ping();  // Send ping, get ping time in microseconds (uS).
  convert = pingRx / US_ROUNDTRIP_CM; // Convert ping time to distance in cm and print result (0 = outside set distance range)/

  //Serial.print("Distance: ");
  //Serial.print(convert); // Convert ping time to distance in cm and print result (0 = outside set distance range)
  //Serial.println("cm");

  // I commented these out for me, just because I didn't want to add in the library to satisfy the compiler.
  //lcd.print("Distance: ");
  //lcd.setCursor(0, 1);
  //lcd.print(convert);
  //lcd.print(" cm");
}

void setup() {}

void loop()
{
  Sonic(); // C and C++ are case sensitive languages and they also require semicolons ; at the end.
  //(other stuff)
  delay(100);  // Change this later when you add more things to the code, look at the Blink Without Delay example sketch!
}
996  Using Arduino / Project Guidance / Re: Any help? on: March 20, 2014, 08:48:54 pm
There is a password library in the arduino playground called "Password" try it out. Google "Arduino Password Library"
997  Using Arduino / Programming Questions / Re: Ping Pong Scoreboard Code help! on: March 20, 2014, 07:50:37 pm
This might help you.
Code:
const byte buttonPin = 2;     
const byte ledPin =  13;

boolean buttonState = 0;
boolean  lastReading = 0;
long onTime=0;

void setup() {
  pinMode(ledPin, OUTPUT);     
  pinMode(buttonPin, INPUT);     
}

void loop(){
  buttonState = digitalRead(buttonPin);

  if (buttonState == HIGH && lastReading == LOW) // first check to see if the button is pressed ie. HIGH and it is different from lastReading
  {
    onTime = millis(); // record time
    lastReading = HIGH; // prevents the code from entering this IF statement, until lastReading is set to LOW again.
  }

  if (buttonState == HIGH && lastReading == HIGH) // button is still held down
  {
    if ((millis() - onTime) > 3000) // check to see if button is held down for 3 seconds
    {
      digitalWrite(ledPin, HIGH); // if button is held down for 3 seconds, LED on
      lastReading = LOW;
    }
    else
    {
      digitalWrite(ledPin, LOW); // otherwise LED remains off
    }
  }
}
998  Using Arduino / Programming Questions / Re: Arduino/Android Bluetooth project on: March 20, 2014, 04:24:29 am
It is definitely doable because I was able to do it myself, so I can help you. But first, your post is in the wrong place, it should be in the Programming Questions section.

When/if your post does get moved and even if it doesn't, please provide everything you have so far, what app you're using, a link to your Bluetooth module and what you have tried already.

Are you familiar with a terminal program called Putty or Realterm?

One big thing we cringe over, is code format and the use of code tags. If you will, please fix your code using the Arduino software by pressing CTRL+T, and then post it inside [ code ] ... [/ code] tags. Look for the # symbol above the smiley faces.
999  Using Arduino / Project Guidance / Re: Button Help, Up, Down, Select on: March 19, 2014, 10:01:45 pm
So you want the third button to toggle between the two states? Ok, so then use a latch.

Code:
static boolean select = digitalRead(3);
if(select !=  lastSelectState) // lastSelectState will need to be declaired boolean too at the top of your code.
{
   if(select == HIGH)
   {
     lastSelectState = select; // Notice I put this in here and not outside the if statement.
     State = !State; // also declare boolean at the top of your code. Set to false
   }
}

if(State == HIGH)
{
  // code for time on
}
else
{
  //time off
}
1000  Using Arduino / Project Guidance / Re: trying to connect 5 8x8 matrixes only 4 work.the first 1 from left does not. on: March 19, 2014, 12:15:10 pm
You wired it correctly, Im just says to swap the displays around, not the wiring.
1001  Using Arduino / Project Guidance / Re: trying to connect 5 8x8 matrixes only 4 work.the first 1 from left does not. on: March 19, 2014, 11:54:26 am
 If you switch the order around, does the one on the end still not light up? I have that same library and it will work with 8 displays with no problems. The only issue I ever had was power and I solved that with a 5V @800mA cell phone charger.
1002  Using Arduino / Programming Questions / Re: VirtualWire library on: March 18, 2014, 08:38:55 pm
By any chance do you have the virtualwire folder inside another virtual wire folder? Meaning if you go to your libraries folder and click on the virtualwire folder, do you see another folder that say virtualwire with the actual examples, .h and .cpp files inside?

The reason I ask is because your errors are without a doubt from the compiler not able to find the library location and if the library is double foldered, this will cause those errors to occur too. However if you have done everything correctly, then it might just be a bug with the software in which you will need to reinstall it. You wont loose any of your sketches.
1003  Using Arduino / Programming Questions / Re: VirtualWire library on: March 18, 2014, 07:10:46 pm
Well I dont know what else to tell you, your code compiles just fine on my end.
1004  Using Arduino / Programming Questions / Re: VirtualWire library on: March 18, 2014, 05:43:11 pm
The compiler does not know where the library is located. Where did you put it? It should be in the Arduino Sketch folder, in a  libraries folder, in your MyDocuments.
1005  Using Arduino / Programming Questions / Re: VirtualWire library on: March 18, 2014, 04:49:04 pm
You can expand the error box and take a screenshot.
Pages: 1 ... 65 66 [67] 68 69 ... 253