Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Programming Questions & Help >> Programs >> arduino library in wiring
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1258743802

Message started by mako on 11/20/09 at 19:03:22

Title: arduino library in wiring
Post by mako on 11/20/09 at 19:03:22
hi, im trying to use the followint libraries from arduino, in wiring


#include <Password.h>
#include <Keypad.h>
#include <LiquidCrystal.h> (for 4 bits)


im very new, so just copy and paste the libraries from arduino into the wiring folder, but hey,,,, it doesnt work,
then checked them the *.h and *.cpp

- what do i have to do to make the libraries work?,
tnx

Title: Re: arduino library in wiring
Post by barragan on 11/20/09 at 19:44:03
please pack them or point me to them, IŽll check them out and see what are the changes needed.
hbarragan [at] uniandes.edu.co

Title: Re: arduino library in wiring
Post by mako on 11/21/09 at 10:47:04
Hi Barragan
Awesome job tnx,
this are the libraries,
they are working on my arduino sketch, but I need to use them with wiring to be able to use more pins,

- keypad:
http://www.arduino.cc/playground/Code/Keypad

- password: already in the arduino n wiring libraries (dont know if below program will work)

- LiquidCrystal: already in the wiring, but not in 4 bit mode (I saw in this forum some one doing some thing for this, but didnt publish the library)

This is the software, for a security system (but messages in a lcd 4 bits):

//http://www.arduino.cc/playground/uploads/Code/Password.zip
#include <Password.h>
//http://www.arduino.cc/playground/uploads/Code/Keypad.zip
#include <Keypad.h>

Password password = Password( "1234" );

const byte ROWS = 4; // Four rows
const byte COLS = 4; //  columns
// Define the Keymap
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 7, 6, 5, 4 };// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 12, 11, 10, 8 };


// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

#define ledPin 13

void setup(){

  digitalWrite(ledPin, HIGH);   // sets the LED on
  Serial.begin(9600);
  keypad.addEventListener(keypadEvent); //add an event listener for this keypad
}

void loop(){
  keypad.getKey();
}

//take care of some special events
void keypadEvent(KeypadEvent eKey){
  switch (keypad.getState()){
    case PRESSED:
     Serial.print("Pressed: ");
     Serial.println(eKey);
     switch (eKey){
       case '*': guessPassword(); break;
       case '#': password.reset(); break;
        default:
              password.append(eKey);
     }
  }
}

void guessPassword(){
     Serial.print("Guessing password... ");
     if (password.evaluate()){
          digitalWrite(ledPin,HIGH);
          Serial.print("bien");
     }else{
          digitalWrite(ledPin,LOW);
          Serial.print("n'est bien");
     }
}


Title: Re: arduino library in wiring
Post by barragan on 11/23/09 at 17:06:27
hi Mako, both Keypad and Passwd work well with Wiring with no changes, just drop the folders for both libraries inside the Wiring/libraries folder, are you in a mac or Windows?

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.