Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpPrograms › arduino library in wiring

Page Index Toggle Pages: 1
arduino library in wiring (Read 10670 times)
11/20/09 at 19:03:22

mako   Offline
YaBB Newbies
Colombia

Posts: 2
*
 
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
 
IP Logged
 
Reply #1 - 11/20/09 at 19:44:03

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
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
 
IP Logged
 
Reply #2 - 11/21/09 at 10:47:04

mako   Offline
YaBB Newbies
Colombia

Posts: 2
*
 
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");
     }
}

 
IP Logged
 
Reply #3 - 11/23/09 at 17:06:27

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
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?
 
IP Logged
 
Page Index Toggle Pages: 1