Show Posts
Pages: 1 [2] 3 4 ... 13
16  Using Arduino / Programming Questions / Re: keypad.addEventListener problem on: January 26, 2014, 07:27:40 pm
Can somebody plss help me how to put keypad.addEventListener for int function...

MENU3.ino: In function 'void eventSchedM(KeypadEvent)':
MENU3:112: error: invalid conversion from 'int (*)()' to 'void (*)(char)'
MENU3:112: error: initializing argument 1 of 'void Keypad::addEventListener(void (*)(char))'

keypad.addEventListener(name_of_event_function) creates a new call-back function everytime you call it. So everytime you press the A or C key you are creating a duplicate function pointer for the associated name. In your code that would be the function c1(). Also, you are trying to create two event listeners (c1() and eventView2()) when the library only supports one. Unless you understand function pointers you may not want to do that. Plus, you are trying to change the call-back function from a return value of void to int.  It doesn't make sense for it to have a return value because it is called within the library and never from your sketch.

It's a bit abstract and if you don't understand call-backs and function pointers then you should follow the EventKeypad.ino example provided with the library.

From the main menu "File -> Examples -> Keypad -> EventKeypad" will load a sketch that demonstrates proper usage.

From your attempts to use addEventListener() I can see that you are struggling with understanding its proper use.  I can help you with that but it might be a lot easier if you were to tell me what you are trying to accomplish. Then we might be able to help you design your sketch.
17  Using Arduino / Interfacing w/ Software on the Computer / Re: This C# app Stucks ....Can any one say Why?? on: January 25, 2014, 11:54:36 am
True.

But as it is not directly pertinent to Arduino I did not feel the need to elaborate.
18  Using Arduino / Interfacing w/ Software on the Computer / Re: This C# app Stucks ....Can any one say Why?? on: January 25, 2014, 10:07:21 am
... i cant close it or click another button in form after i start reading ports...
so can any one tell me why is that ???
This is really a c# problem:  It's because you are running these three lines of code inside the while(port.IsOpen) loop and never leaving the loop to run anything else.

Quote
Code:
           while (port.IsOpen)
            {
                data = port.ReadLine().Split(',');

                textBox1.Text = data[0];
                textBox2.Text = data[1];
            }
 


c# provides Application.DoEvents() to allow other portions of your program to have some processing time when you are running a tight loop as above.
 
Code:
            while (port.IsOpen)
            {
                data = port.ReadLine().Split(',');

                textBox1.Text = data[0];
                textBox2.Text = data[1];

                Application.DoEvents();  ///Allow other parts of your program to receive messages/events.
            }
 
19  Development / Other Software Development / Re: Arduino Keypad lib 4.0 augmented with password/secret code recognition on: January 24, 2014, 03:30:28 pm
I'm not even completely sure what I mean...

I've been asked for passwords (like your utility), strings, and numbers (ints, floats, hex) greater than a single keypress.  Basically whatever the person wanted in their sketch at the time.

It got me thinking that maybe a buffer could be implemented.  I'm still not sure about returning different types. I thought I would have to use C++ templates but I wanted the library code to remain simple enough for sketch authors. I guess templates aren't any worse than the virtual functions I used. I'm also trying to be careful about adding things that aren't keypad related. For example, it doesn't make sense to have the keypad performing math functions.

I guess the same could be said about passwords but I really liked the method you used to implement it. That's what got me back on the idea of a buffer, or que. It would be great to have a que that could return any type.

So those are my thoughts but I'm not really committed to anything. It's just that your code brought everything to the front again. Thanks smiley-wink

-Mark
20  Development / Other Software Development / Re: Arduino Keypad lib 4.0 augmented with password/secret code recognition on: January 23, 2014, 11:26:22 pm
Hi myoan,

I just caught the changes you made to the Keypad library and it looks really clean.  However, "My" version of the Keypad library is not so "official" smiley-wink.  I originally wrote it for myself and then just got carried away trying to make it as simple as possible to use.  I've had many people ask for the ability to que arbitrary strings or numbers but I couldn't figure out how to do it without inheriting the string library.  I wonder if you would be willing to give it a try and extend your changes even further?

-Mark
21  Using Arduino / General Electronics / Re: 4x4 Keypad on I2C on: January 18, 2014, 11:37:00 am
If you are using the matrix keypad library http://playground.arduino.cc//Code/Keypad from the Arduino Playground then Joe Young has extended it to use I2C.  You can find the Keypad_I2C library here https://github.com/joeyoung/arduino_keypads.  It will require the use of two additional I2C port expander chips but Joe provides documentation and explains everything.
22  Using Arduino / Project Guidance / Re: Assistance on Keypad on: January 18, 2014, 11:24:22 am
Hello ZP,

Sorry for the late reply but you will probably get more replies if you move your message to the Programming forum.

The only problem that I seem to be having is that my keypad is not registering the 2, 5, 8, 0, 4, 5, and 6.

It sounds like you are saying that nothing happens at all when you press those keys.  Do you see any output at all? It could help me determine if it's a wiring problem or something else.

Quote
I attempted to do some research into this 4x3 keypad...

Try the keypad tutorial in the playground, http://playground.arduino.cc//Main/KeypadTutorial. It may provide you with some additional insight into solving your problem. Most of the problems I see like this are due to wiring errors.

Quote
I am new to Arduino so bear with me.  If any further code is needed to understand my problem, please advise.  Any assistance is appreciated in advance!

Actually, how about some photos?  Close-ups of your wiring might help if they are clear enough.

Regards,
Mark
23  Using Arduino / Programming Questions / Re: Keyboard lib full nkro? on: December 12, 2013, 07:46:10 am
It depends on the type of keyboard you are talking about. 

For a matrix style keyboard you can read about it here: http://playground.arduino.cc/Code/Keypad.  The default settings support up to 160 keys with 10 key rollover.  However if you want to eliminate key ghosting and key jamming you will need to have isolation diodes installed on each key.

For using a regular keyboard with the Due or Leonardo http://arduino.cc/en/Reference/MouseKeyboard it looks like you can get nkro support by using the function calls Keyboard.press() and Keyboard.release().  You will still need a library for reading the keypresses of a PS2 or USB keyboard.

Check here http://playground.arduino.cc//Main/InterfacingWithHardware#keyb for a list of keyboard libraries on the Arduino playground.

Regards
24  Using Arduino / Programming Questions / Re: Library issue #include not turning orange on: November 17, 2013, 08:36:45 am
You're missing your keywords.txt file.  You create it to tell the Arduino IDE what types of keywords you want.  I've attached an example of mine.

Put it in the same folder as your library .ccp and .h files.  Also, it is very critical that you format it correctly.  There is one, and only one, tab between the keyword and its type specifier.
25  Using Arduino / Programming Questions / Re: Anyone successful using the Keypad library with an ATMega1284P ??? on: November 11, 2013, 10:30:32 pm
The scope plot looks like the column pin is trying to go low but for some reason it won't.  Can you try adding an external pulldown resistor and scope it again? 4.7k to 22k should do.

We could also try adding a small delay in the keypad.cpp file.  Look for the scanKeys() function and find the line:
Code:
     pin_write(columnPins[c], LOW); // Begin column pulse output.
     delay(1);      // <------- Add this for testing and scope it again.

I wonder, too, if it could be a problem with my virtual function pin_write()?  Try changing the code again:
Code:
     // Comment this out:
     // pin_write(columnPins[c], LOW); // Begin column pulse output.
     // Then add this:
     digitalWrite(columnPins[c], LOW); // Begin column pulse output.

I'm just trying to figure out how such a simple function can fail to change the pin.
26  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.

27  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.
28  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.
29  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.

30  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.
Pages: 1 [2] 3 4 ... 13