Show Posts
Pages: 1 ... 5 6 [7] 8 9 ... 13
91  Using Arduino / Programming Questions / Re: Conflicting Libraries on: January 18, 2013, 09:39:22 am
I grepped (searched) every single file in the Arduino 1.0.1 software download and the only results were .o files that contained __vector_7.

Then I checked out line 523 in Tone.cpp and found the definition for an ISR called ISR(TIMER2_COMPA_vect)

grepping Tone.cpp again I found
Code:
#define TIMER2_COMPA_vect TIMER2_COMP_vect

grepping all files for TIMER2_COMP_vect resulted in 23 files with names like iom???.h that contained
Code:
#define TIMER2_COMP_vect    _VECTOR(#)
where # = 3, 4, 9, and 10.  But there were no 7's.

Switching tactics I googled Tone.cpp:523: multiple definition of `__vector_7'

This post in the forums might contain your solution if you are not using interrupts with the Ping sensor. http://arduino.cc/forum/index.php/topic,106043.msg960630.html#msg960630
92  Using Arduino / Project Guidance / Re: Making a custom keyboard with arduino? on: January 18, 2013, 07:50:09 am
I intend to use cherry MX switches for my keys,
Wow, these things seem to be getting popular.  Both you and the other person I'm working with are using those keys.

Quote
according to the specs on the website, there are some with diodes and some without, should I get the ones with diodes, or should I get my own diodes?
Time to learn a technique in engineering called tradeoffs. smiley-wink  If the cost of the keys with diodes is higher than buying separate diodes then it may be worth your time to do it yourself.  External diodes also mean your build won't be as neat and clean so that's another consideration.

But from a purely technichal point-of-view it would be better to get the ones with diodes.
93  Using Arduino / Programming Questions / Re: Conflicting Libraries on: January 17, 2013, 11:01:47 pm
I just searched for vector in the libraries and it is not there.  Do you mind posting the error you are getting?  Maybe it will help clarify things.
94  Using Arduino / Project Guidance / Re: Help with using Arduino Uno i/o pins as both input and output on: January 17, 2013, 10:56:18 pm
The "problem" is that I would like to use the pins (2-9 specifically, not that it matters that much) as an output, and an input within the same sketch.
It's time for bed so just a quick note to let you know that the technique you are talking about is called multiplexing.  Try searching on multiplexing LEDs with Arduino.
95  Using Arduino / Project Guidance / Re: Making a custom keyboard with arduino? on: January 17, 2013, 10:43:58 pm
you can use keypad.h library to read a 72 key keypad.
[Snip]
Multi-press, that would be managed in your sketch.
Actually, the keypad library has been multi-press capable since July of last year.  I didn't make an announcement yet because I was hoping for a relatively slow testing period.  But it's posted and I'm working with someone right now who is implementing a full multi-press (a.k.a. n-key-roll-over, nkro) keyboard.  As soon as I get a report from him I will upload the latest fixes (the last key wouldn't report that it was released).  Shouldn't be more than a day or so.
96  Using Arduino / Project Guidance / Re: Making a custom keyboard with arduino? on: January 17, 2013, 10:32:31 pm
but I didn't know if Arduino was capable of  managing a <70 key keyboard, and if so, could I have a fn key that changed the use of certain keys? (i.e. fn+1=f1) Also what would muti-press limitations be?
Yes, you can use Arduino to make a full sized keyboard.  I've helped a couple of people accomplish just that.  The keypad library http://playground.arduino.cc/Code/Keypad has default support for a 10x16 (160 key) keyboard.

Multi-press will have a problem called ghosting.  That means if you press 3 keys in a triangle then a fourth key will also appear to be pressed.  Release any one of the 3 keys and the ghost will go away too.  Ghosting is normally solved by using individual series diodes with each key.
97  Using Arduino / Project Guidance / Re: need an estimate of time required to scan 11x8 matrix on: January 17, 2013, 10:19:21 pm
You should read up what debunce means. You can't debunce in a millisecond.
Actually it might be possible.  I use a state machine to debounce after scanning so if his hardware needs to have the scan completed in 1mS the debouncing could be completed separately.  Some things would need to be stripped out of the code but who knows what might work.

How do you know only one button will be pushed at a time ?
If your requirement is to test for a single button then you simply ignore everything else after detecting the first one.

Another way is to store Highs and Lows into an array for ALL the buttons that are being pushed.  Then you can post-process the array any way you like.  With a 1mS time limit I assume that his hardware is not a keyboard and may return multiple detections per scan.
98  Using Arduino / Project Guidance / Re: need an estimate of time required to scan 11x8 matrix on: January 17, 2013, 06:31:21 pm
Why not try it with the Keypad.h library, see if its fast enough?
I throttle the keypad library so a slight modification would be required before he could do this.  I tested a sketch with the throttling removed and just as Magician said it requires 448uS per loop.  Of course that includes the entire sketch so his calculated value of 440uS is slightly more accurate.
99  Using Arduino / Programming Questions / Re: SOLVED: Getting Error:- 'INPUT_PULLUP' was not declared in this scope on: January 12, 2013, 09:11:21 pm
It seems crazy to be using the INPUT_PULLUP mode at all since it just adding to the confusion and is not needed.
This is a very compelling argument. It seems that I was trying to fix a problem that didn't exist.

Quote
I'd go in and rip out the all the INPUT_PULLUP stuff since it simply is not needed.
I'm going to do this. I'm debugging a problem with the library right now and when I am finished I will also update the library with the INPUT_PULLUP stuff removed.

Thanks bperrybap
100  Using Arduino / Programming Questions / Re: SOLVED: Getting Error:- 'INPUT_PULLUP' was not declared in this scope on: January 12, 2013, 02:25:36 pm
It masks the problem, not solving the problem.
Actually, it should be a resonable fix in the case of the keypad library.  The offending lines in Keypad.cpp are:
Code:
// When sharing row pins with other hardware they may need to be re-intialized.
for (byte r=0; r<sizeKpd.rows; r++) {
pin_mode(rowPins[r],INPUT_PULLUP);
pin_write(rowPins[r],HIGH); // Enable internal pullup resistors for Arduino<101
}
I did this to maintain some sort of backwards compatibility but my error was in deciding to test for Arduino versions instead of the existence of INPUT_PULLUP.
Code:
// See http://code.google.com/p/arduino/issues/detail?id=246
#if defined(ARDUINO) && ARDUINO < 101
#define INPUT_PULLUP INPUT
#endif
Becomes...
Code:
// See http://code.google.com/p/arduino/issues/detail?id=246
#if !defined INPUT_PULLUP
#define INPUT_PULLUP INPUT
#endif
101  Using Arduino / Programming Questions / Re: Getting Error:- 'INPUT_PULLUP' was not declared in this scope on: January 11, 2013, 06:59:25 pm
Hi tack,
This is an error being received with a library, so it's not code in my sketch. I guess I could go and modify all the INPUT_PULLUP uses in the library to PinMode(pin, INPUT) and digitalWrite(pin, HIGH) but I was hoping there was a more elegant solution, such as updating the mighty1284P core files so I don't have to change the library every time an update is released.

If you don't mind running a quick test for me...

Change line 46 in keypad.h from:
Code:
#if defined(ARDUINO) && ARDUINO < 101

to:
Code:
#if !defined INPUT_PULLUP

And see if it works for you.  If so then I will update the library so you won't have to mess around with it.

-Mark Stanley
102  Using Arduino / Displays / Re: a simple 32 character text writer with 4 keys, detect still pressed ? on: December 21, 2012, 08:06:41 pm
This is great news and I'm really surprised that it works with v22 of the Arduino software.  I attempted to maintain backward compatibility but in truth I never tested the library on anything older than Arduino 1.0.

Thanks for the info.  It gives me greater confidence. smiley-wink
103  Using Arduino / Displays / Re: a simple 32 character text writer with 4 keys, detect still pressed ? on: December 19, 2012, 09:20:29 pm
Hi Boffin1,
I tried including  KeyState getState()   but it says its not declared in this scope but it looks like a function of Keypad.h ?

Is there another option to if (key)   that will not cause debounce hassles ?
You were correct in assuming that getState() is what you would use to solve your problem.  It returns one of four states IDLE, PRESSED, HOLD, or RELEASED which you can test, eg.

Code:
  if ( kpd.getState() == HOLD ) {
      // reset your repeat timer
  }
I don't understand why you are getting a scope problem, though.  The function is public and you should be able to use it.  Can you show me an example of what you wrote when it gave you the compile error?
104  Using Arduino / Programming Questions / Re: Editing a Library on: December 19, 2012, 08:59:19 pm
Hi euphoricnoise, sorry about the late reply but I am just getting over the flu.

-I am trying to build a 16 buttonpad MIDI controller using the sparkfun 4x4 board (https://www.sparkfun.com/products/7835?)
-Right now, the controller can take in one button input and output one thing (monophonic)
-I am trying to program the arduino so more than one button input can be taken in (polyphonic)

The latest version, 3.0, of the keypad library supports up to 10 active keys all being pressed at the same time.  I wanted to give you an example but I see that I botched the upload so the multikey example included with the library download is completely off the mark.

I've included my initial draft of that example here.  Two things to notice are that you should use kpd.getKeys() for scanning multiple key presses and that you will get a list of keys in the kpd.key[] array.

The array kpd.key[] is an array containing keys that have the following members:

  char kchar;
  KeyState kstate;            // IDLE, PRESSED, HOLD, RELEASED
  boolean stateChanged;


Hopefully this is enough to get you going on your project.  I will work on the multikey example over the holidays and see if I can update the Keypad page http://playground.arduino.cc/Code/Keypad too.

Code:
/* @file MultiKey.ino

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the kpd
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the kpd

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
}

void loop(){

  // Fills kpd.key[] array with up-to 10 active keys.
  // Returns true if there are ANY active keys.
  if (kpd.getKeys())
  {
    for (int i=0; i<LIST_MAX; i++)   // Scan the entire list.
    {
      if (kpd.key[i].kchar != NO_KEY)    // Test for an active key.
      {
        switch (kpd.key[i].kstate) {  // Test for key state IDLE, PRESSED, HOLD, or RELEASED
            case HOLD:
                Serial.print("Key ");
                Serial.print(kpd.key[i].kchar);
                Serial.print(" is being HELD and the state ");
                if (!kpd.key[i].stateChanged)
                    Serial.println("has not changed.");
                else
                    Serial.println("has changed.");
                break;
            case PRESSED:
                Serial.print("Key ");
                Serial.print(kpd.key[i].kchar);
                Serial.print(" is PRESSED and the state ");
                if (!kpd.key[i].stateChanged)
                    Serial.println("has not changed.");
                else
                    Serial.println("has changed.");
                break;
            case RELEASED:
                Serial.print("Key ");
                Serial.print(kpd.key[i].kchar);
                Serial.print(" has been RELEASED and the state ");
                if (!kpd.key[i].stateChanged)
                    Serial.println("has not changed.");
                else
                    Serial.println("has changed.");
                break;
            default:
                Serial.print("Key ");
                Serial.print(kpd.key[i].kchar);
                Serial.print(" is IDLE and the state ");
                if (!kpd.key[i].stateChanged)
                    Serial.println("has not changed.");
                else
                    Serial.println("has changed.");
        }
      }
    }
  }
}  // End loop
105  Community / Exhibition / Gallery / Re: Low power consumption (0.1 uA) but wake up on keypad press on: December 06, 2012, 10:38:14 pm
Hi Nick & Everyone,

  I've been following this post with great interest. Of course I'm finding the low power stuff to be very interesting but equally as important I was discovering what impact my changes have made between the two versions of the library.

Nick:  You are using version 1.8 of the library (Keypad2) which had the original problem with shorted pins when pressing multiple keys. Since then I've implemented your suggestions so the latest version, 3.0, includes those fixes.

Zigmund:  Along the way I figured out that I could drastically improve the number of times the loop runs per second by restricting the number of calls to the library to once every 10 milliseconds (mS) by default. The default can be changed by setDebounceTime(1) which sets the debounce time to 1mS which is the minimum.  By reducing the debounce time it allows getKey() to be called more frequently.  I would love to hear how it affects the responsiveness when using version 3.0 of the library.  I may need to change my method of limiting.
Pages: 1 ... 5 6 [7] 8 9 ... 13