Show Posts
Pages: 1 [2] 3 4 ... 12
16  Using Arduino / Programming Questions / Re: Anyone successful using the Keypad library with an ATMega1284P ??? on: November 11, 2013, 09:59:31 pm
-- Pat, that's really good news! It also gives me an idea of what went wrong.

-- CrossRoads, based on what happened with Pat I believe it might have been caused by how he moved the Arduino.h and wiring_digital.c files from the Arduino cores and placed them in maniacbug's build.  Is there any chance you might have done the same thing?  Also, what version of the IDE are you running?  I've had a statistically significant number of problems that were fixed by moving away from version 1.0.3 of the software.

17  Using Arduino / Programming Questions / Re: Detect presence 5V square wave on five pins simultaneously on: October 13, 2013, 04:05:25 pm
Detect presence 5V square wave on five pins simultaneously

How could I do this from software on five pins?
Take a look in the Arduino reference. http://www.arduino.cc/en/Reference/PortManipulation

It may be what you are talking about.
18  Using Arduino / Programming Questions / Re: Script Stopped working Corectly after a year, Arduino Serial Monior freezes ? on: October 08, 2013, 11:16:53 am
It has been working in a project bix now for a year.
Since code doesn't go bad over time you have a hardware problem on your hands.

Since you already swapped out the relay board I suspect that back emf from the relays has already damaged your Arduino.  Try replacing it.  However you should check the power supply (voltage) in your circuit and on your Arduino before hand to make sure they are correct.

Of course this is all conjecture based on what you said but if you show some schematics it would really help.
19  Using Arduino / Programming Questions / Re: Keypad Library Multi-press Error on: October 04, 2013, 07:01:18 am
It looks like you are trying to compile a more recent example sketch against an older version of the library that doesn't support multiple keypresses.

You need to go through the Arduino "libraries" folder on your system and make sure that you don't have more than one copy of the Keypad library installed.  There is some information here (http://arduino.cc/en/Guide/Libraries) that might help you to find all the locations where the copies of the Keypad library might be installed.

20  Using Arduino / Programming Questions / Re: A better way to debounce buttons for sending UART keyboard messages. on: September 27, 2013, 12:04:58 pm
There are definitely some things you can do to improve your code but because you need state tracking for the buttons you have the added benefit of already using the best method for debouncing buttons.  You just need to turn your state tracking into a state machine by using a switch/case statement.

I was thinking a button array, possibly.
That's the method I used in the keypad driver.  You can save a lot of space by using the bitRead() and bitWrite() functions found on the Arduino Reference page.

Quote
All the examples I see on the web do not send just a single report when pushing the button down and then another on the release.
That's generally a problem caused by not using a state machine or state tracking.  They can't tell when a button has actually changed so the code gets out of hand very quickly.

Quote
Any ideas or better methods to reduce code? I am also worried about SRAM usage.
Yes, but I'm at work right now so this will be a bit short to start with.

You need to move your state tracking into a separate function that takes the button's previous state and pin number as variables so you can do all your state checking/updating only when called.

As I said above, create a bitMap array of any type of variable that can be used by bitRead() and bitWrite() and use that to store your states for each button.

That will help clean up your code but I would wait until you are through making everything work before you try to reduce ram usage.
21  Using Arduino / Programming Questions / Re: GSM moden library conflict? on: September 13, 2013, 12:20:50 pm
It seems to be a conflict between libraries Keypad and GSM...
Any idea how to solve it?
I made a first attempt at including a namespace in the keypad library which I just attached below.  I did this while at work so I haven't had a chance to test it out.  If you want to use the attached copy of the keypad library then you will need to change the KeyState variables (IDLE, PRESSED, HOLD, or RELEASED) in your sketch to m_key::IDLE, m_key::PRESSED, m_key::HOLD, and m_key::RELEASED.
22  Using Arduino / Programming Questions / Re: Cell number logged with Keypad on: September 05, 2013, 08:06:02 pm
I added waitForKey() to the library a little while ago so you could have just done:
Code:
void User_Int()
{
  lcd.clear();
  lcd.print("Enter Cell no.");
  char Cell_num[10];
  for(int i=0;i<10;i++)
  {
   Cell_num[i]=keypad.waitForKey();
  }
  lcd.print(Cell_num);
  delay(1000);
}
23  Using Arduino / Programming Questions / Re: How To Use digitalRead on Serial Pins 0(RX)/1(TX) on Arduino Uno on: September 03, 2013, 07:39:40 pm
You can use the 4 datalines of the display for other things.
Is the keypad library interrupt driven ? If not, you can perhaps use 4 outputs of the Arduino for both the datalines of the display and also 4 output lines for the keypad. I'm not sure of it, I would have to check the libraries.
You are correct. If matzeatweb is using the Keypad library http://playground.arduino.cc/Code/Keypad and the LiquidCrystal library [Sketch -> Import Library... -> LiquidCrystal] then yes, they are written so that the 4 data pins from the LCD and the Row pins of the keypad can be connected together.
24  Using Arduino / Programming Questions / Re: Can anyone tell me what is the connection with the android in this arduino code on: August 30, 2013, 11:44:46 am
Well, if my assumptions are correct the meetAndroid would connect you to the Android device.

You might want to check out http://www.amarino-toolkit.net/index.php/tutorials.html for tutorials on how to pair with your bluetooth module.  The first tutorial is the First connection and Test Event Tutorial.
25  Using Arduino / Programming Questions / Re: C++ Problem with a Class on: August 08, 2013, 10:42:07 am
mstanley:
Thank you - But I did not want t inherit on purpose:
I want to hide anything from the original class, and be able to "start from scratch",
that's why I chose to contain an object, instead of inheriting the class.

What else can I do?
Then you will need to move
Code:
NECIRrcv*  m_ir;
  outside (ahead) of your class.  That will make your m_ir object have global scope thus making it available to your class.  I believe the wire library uses the same technique to make a global object available.  You can see what I am talking about at the bottom of the Wire.cpp file:
Code:
// Preinstantiate Objects //////////////////////////////////////////////////////

TwoWire Wire = TwoWire();
26  Using Arduino / Programming Questions / Re: C++ Problem with a Class on: August 08, 2013, 10:29:09 am
I tried to do a very simply thing:

To create a simple class, that will be called "IR_Receiver",
which will contain an object of NECIRrcv.

The reason I want to create this class, is in order to add some more methods of mine.
What you need to do is have your class inherit (class inheritance) the NECIRrcv class.  Then you will be able to extend it (extend a class) with your own methods.  What I gave here is a VERY rough example (won't compile, won't run, and may not even teach you anything) in order to give you something to search on.  I've bolded the keywords you'll want to search.

Code:
#include "NECIRrcv.h"
class IR_Receiver : public NECIRrcv {
  public:
// Members:
NECIRrcv*  m_ir;
unsigned long ircode;

//Methods:
IR_Receiver(int);
unsigned long ReceiveIfAvailable();
};

// These two class methods could be placed in the IR_Receiver.cpp file.
// Constructor
IR_Receiver::IR_Receiver(int SetLeg)  {
NECIRrcv ir2(SetLeg);
m_ir  =&ir2;
m_ir->begin();
}

unsigned long IR_Receiver::ReceiveIfAvailable()  {
if(m_ir->available())  {
ircode = m_ir->read();
return ircode;
}
else  {
return 0;    //No Code Available
}
}



void setup()  {
  Serial.begin(9600);
  Serial.println("Up");
}

IR_Receiver O_IR_Receiver(4);
unsigned long IR_Code;

void loop()  {
  IR_Code  O_IR_Receiver.ReceiveIfAvailable();
  if(IR_Code!=0)  {
    Serial.println(IR_Code,HEX);
  }
}
27  International / Français / Re: Librairie keypad.h on: August 05, 2013, 08:50:11 pm
GD Joe Young a prolongé la bibliothèque du clavier avec un port I2C. Vous pouvez le trouver sur github.
https://github.com/joeyoung/arduino_keypads

Google traduit
28  Using Arduino / Programming Questions / Re: Library 'does not name a type' and 'not declared in this scope' on: July 01, 2013, 03:47:51 am
You may have to reset your sketchbook location.  Try going to File->Preferences and setting Sketchbook location: to C:\Documents and Settings\Warren\My Documents\arduino [Note that I didn't include libraries at the end of the path.]

Usually your preferences should last from one update to the next but who knows...
29  Using Arduino / Programming Questions / Re: Interesting discovery - Can you figure out what's wrong? on: June 29, 2013, 07:05:10 am
Unfortunately warnings are disabled in the Arduino compiler
More like "disabled by default".  If you go to File->Preferences and check the box for compilation next to Show verbose output during: then hit verify you get the following compiler output:

Blink.ino: In function 'String test(char, int, String)':
Blink.ino:32: warning: control reaches end of non-void function

Quote
(presumably because it confuses newcomers to programming)world.
I like to think that it protects those of us who like to help from programmers and newcomers who might have O.C.D. smiley-wink
30  Using Arduino / Programming Questions / Re: Function Calls vs Header & .cpp File Manipulations on: June 27, 2013, 10:25:23 am
Quote
When you hit the verify or load button you will see a ram usage report when the compiler is finished

No, that's program memory, thanks though!
Yeah, I guess the word RAM should have been my clue.  smiley-confuse
Pages: 1 [2] 3 4 ... 12