Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: setting an output on: December 05, 2012, 04:22:02 pm
thanks jimmy60, any chance you know anything about running a 12v dc pump with the arduino, i tried using a tip102 transistor with an external 12v psu, but when i turn the psu on it runs staright away.

ideally what i want to do is have a passcode put into my keypad and it'll turn one pump on and a second password turn a 2nd pump one.

the passcode sketch i have uploaded works already fine but when i ry rig the pump up i'm getting nowhere

i have it rigged up like this

http://itp.nyu.edu/physcomp/Tutorials/HighCurrentLoads

i have a small bank of 4 relays if its possible to use these instead?
2  Using Arduino / Programming Questions / Re: setting an output on: December 05, 2012, 03:44:37 pm
thanks its sorted now, how do i use ide format feature?
3  Using Arduino / Programming Questions / Re: setting an output on: December 05, 2012, 02:24:25 pm
Code:
#include <Password.h> //
#include <Keypad.h> //

Password password = Password( "001" );
Password password2 = Password( "002" );
int ledPin1 = 13;
int ledPin2 = 12;
const byte ROWS = 4; // 4 rows
const byte COLS = 3; // 3 columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};

byte rowPins[ROWS] = { 5,4,3,2};
byte colPins[COLS] = { 8,7,6, };


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

void setup(){
  pinMode(ledPin1, OUTPUT);    
}

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 '#':
        checkPassword();
        checkPassword2();
        break;
     case '*':
        password.reset();
        password2.reset();
        break;
     default:
        password.append(eKey);
        password2.append(eKey);
  }
}
}

void checkPassword(){
if (password.evaluate()){
    digitalWrite(ledPin1, HIGH);
    delay(1000);
    digitalWrite(ledPin1, LOW);
    digitalWrite(ledPin2, HIGH);
    delay(2000);
    digitalWrite(ledPin2, LOW);
    password.reset();
    password2.reset();
}
}
void checkPassword2(){
if (password2.evaluate()){
digitalWrite(ledPin2, HIGH);
    delay(1000);
    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin1, HIGH);
    delay(2000);
    digitalWrite(ledPin1, LOW);
    password.reset();
    password2.reset();
}
}


Moderator edit: [code] [/code] tags added.
4  Using Arduino / Programming Questions / Re: setting an output on: December 05, 2012, 01:24:26 pm
when i try

pinMode(ledpin1, OUTPUT);

this is the error i get


_2pass:16: error: expected constructor, destructor, or type conversion before '(' token
5  Using Arduino / Programming Questions / setting an output on: December 04, 2012, 03:30:50 pm
here is my sketch i want to set ledpin1 and ledpin2 as outputs but everytime i try i get error message

#include <Password.h> //
#include <Keypad.h> //

Password password = Password( "001" );
Password password2 = Password( "002" );
int ledPin1 = 13;
int ledPin2 = 12;
const byte ROWS = 4; // 4 rows
const byte COLS = 3; // 3 columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};

byte rowPins[ROWS] = { 5,4,3,2};
byte colPins[COLS] = { 8,7,6, };


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

void setup(){

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 '#':
        checkPassword();
        checkPassword2();
        break;
     case '*':
        password.reset();
        password2.reset();
        break;
     default:
        password.append(eKey);
        password2.append(eKey);
  }
}
}

void checkPassword(){
if (password.evaluate()){
    digitalWrite(ledPin1, HIGH);
    delay(1000);
    digitalWrite(ledPin1, LOW);
    digitalWrite(ledPin2, HIGH);
    delay(2000);
    digitalWrite(ledPin2, LOW);
    password.reset();
    password2.reset();
}
}
void checkPassword2(){
if (password2.evaluate()){
digitalWrite(ledPin2, HIGH);
    delay(1000);
    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin1, HIGH);
    delay(2000);
    digitalWrite(ledPin1, LOW);
    password.reset();
    password2.reset();
}
}
6  Using Arduino / General Electronics / Re: 2v output on arduino on: October 04, 2012, 03:13:27 pm
i check the voltage coming out of the pin at 5v when it is on, but once i connect it to the relay and check voltage again its only 2v and my relay needs 5v to switch. the relay has already got a diode in parallel with the coil for protection so chip isn't fried.
7  Using Arduino / General Electronics / Re: 2v output on arduino on: October 02, 2012, 01:26:18 pm
hi coil resistance is 320 ohms
8  Using Arduino / General Electronics / 2v output on arduino on: September 14, 2012, 12:31:56 pm
hi i have my arduino output pin connected to a relay, but it is only giving me 2v from output pin? i need 5v to switch the relay
9  Using Arduino / General Electronics / relay with output pin on: August 02, 2012, 03:59:58 pm
i want to drive a small put dat takes 12vdc at 1.2amp. i have a relay capable of switching its contacts at 5v so was goin to use the output pin of my arduino board as signal control to switch on the relay and an external power source for the 12vdc on the contacts of relay. my question is whether or not i have to use a transistor and a diofe across the relay coil to protect the board or will it be ok with just using the relay?
10  Community / Products and Services / Re: expansion i/o board on: August 01, 2012, 02:37:49 pm
thanks for the link and suggestions smiley
11  Using Arduino / Programming Questions / Re: multiple codes with keypad on: July 31, 2012, 12:26:16 pm
apologises i thought i had my keypad setup to have the # key as the enter rather than the * key, above code works fine
12  Using Arduino / Programming Questions / Re: multiple codes with keypad on: July 31, 2012, 11:28:14 am
ok here's my new code when input the first password(001) it works perfect but if i try input password 2(002) nothing happens at all

#include <Password.h> //
#include <Keypad.h> //

Password password = Password( "001" );
Password password2 = Password( "002" );
int ledPin1 = 13;
int ledPin2 = 12;
const byte ROWS = 4; // 4 rows
const byte COLS = 3; // 3 columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};

byte rowPins[ROWS] = { 5,4,3,2};
byte colPins[COLS] = { 8,7,6, };


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

void setup(){

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 '*':
        checkPassword();
        checkPassword2();
        break;
     case '#':
        password.reset();
        password2.reset();
        break;
     default:
        password.append(eKey);
        password2.append(eKey);
  }
}
}

void checkPassword(){
if (password.evaluate()){
    digitalWrite(ledPin1, HIGH);
    delay(1000);
    digitalWrite(ledPin1, LOW);
    digitalWrite(ledPin2, HIGH);
    delay(2000);
    digitalWrite(ledPin2, LOW);
}
}
void checkPassword2(){
if (password2.evaluate()){
digitalWrite(ledPin2, HIGH);
    delay(1000);
    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin1, HIGH);
    delay(2000);
    digitalWrite(ledPin1, LOW);
}
}
13  Community / Products and Services / expansion i/o board on: July 30, 2012, 03:56:53 pm
hi im looking for an expansion board which will give me more than the original 13 pins i have on my Uno, anyone suggest one?
14  Using Arduino / Programming Questions / Re: multiple codes with keypad on: July 30, 2012, 03:10:51 pm
here's the code, i'm just using an led as output for the moment. at the minute when i enter the code 001 and press # the led turns on and if i clear the code with * led turns off, but i want to add another code say 002# to turn on another seperate led

/*
||  Simple Password Entry Using Matrix Keypad
||  4/5/2012 Updates Nathan Sobieck: Nathan@Sobisource.com
||
*/


//* is to validate password   
//# is to reset password attempt

/////////////////////////////////////////////////////////////////

#include <Password.h>
#include <Keypad.h>

Password password = Password ( "001" );
int ledPin = 13;
const byte ROWS = 4; // Four rows
const byte COLS = 3; //  columns
// Define the Keymap
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};

byte rowPins[ROWS] = { 5,4,3,2};// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte colPins[COLS] = { 8,7,6, };// Connect keypad COL0, COL1 and COL2 to these Arduino pins.


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

void setup(){

  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 '#': checkPassword(); break;
     case '*': password.reset(); digitalWrite(ledPin, LOW); break;
     default: password.append(eKey);
     }
  }
}

void checkPassword(){
  if (password.evaluate()){
    digitalWrite(ledPin, HIGH);
 
    //Add code to run if it works
  }else{
    Serial.println("Wrong");
    //add code to run if it did not work
  }
}
15  Using Arduino / Programming Questions / multiple codes with keypad on: July 30, 2012, 12:57:00 pm
i have a sparkfun keypad and want to programme it to turn various outputs when certain codes are inputed, how do i write sketch for multiple passwords?? so far i can only get it to accept one
Pages: [1] 2