Documente Academic
Documente Profesional
Documente Cultură
22/09/11 21:50
Main Site Blog Playground Forum Labs Store Help | Sign in or Register
Search
Welcome, Guest. Please login or register. September 22, 2011, 07:50:31 PM are you looking for our old forum?
previous topic
next topic
Print
Author
Cleitonribeiro
Offline
Newbie Posts: 7
gostaria de criar um algoritmo que lesse 6 numeros digitados num teclado numerico e se fosse a sequencia certa, ligaria um rel se alguem pudesse me ajudar obrigado
Logged
Kotch
Brazil
Offline
Experimente dar uma procurada aqui neste link, deve ter algo que te possa ser util http://www.arduino.cc/playground/Projects/ArduinoUsers
Logged
Dualboot: Windows XP + FreeBSD 8.1 5 Arduinos duemilanove
http://arduino.cc/forum/index.php/topic,60028.0.html
Pgina 1 de 6
22/09/11 21:50
Kotch
Brazil
Offline
Logged
Dualboot: Windows XP + FreeBSD 8.1 5 Arduinos duemilanove
Cleitonribeiro
Offline
Newbie Posts: 7
Valeu pela ajuda, vo tenta aqui introduzir esse codigo aqui, qualquer duvida eu posto aqui,
Logged
Cleitonribeiro
Offline
Newbie Posts: 7
consegui um cdigo aqui no forum, da library do key pad, mais no to conseguindo introduzir o que eu quero queria que quando uma senha de 6 digitos fosse digitada acendesse um led, mais no sei como fazer a alterao no cdigo alguem me ajuda, o cdigo eh esse: /* @file EventSerialKeypad.pde || @version 1.0 || @author Alexander Brevig || @contact alexanderbrevig@gmail.com || || @description || | Demonstrates using the KeypadEvent. || # */ #include <Keypad.h> const byte ROWS = 4; //four rows
http://arduino.cc/forum/index.php/topic,60028.0.html
Pgina 2 de 6
22/09/11 21:50
const byte COLS = 3; //four 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 keypad byte colPins[COLS] = {8,7,6}; //connect to the column pinouts of the keypad Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); byte ledPin = 10; boolean blink = false; void setup(){ Serial.begin(9600); pinMode(ledPin, OUTPUT); // sets the digital pin as output digitalWrite(ledPin, HIGH); // sets the LED on keypad.addEventListener(keypadEvent); //add an event listener for this keypad } void loop(){ char key = keypad.getKey(); if (key != NO_KEY) { Serial.println(key); } if (blink){ digitalWrite(ledPin,!digitalRead(ledPin)); delay(100); } } //take care of some special events void keypadEvent(KeypadEvent key){ switch (keypad.getState()){ case PRESSED: switch (key){ case '#': digitalWrite(ledPin,!digitalRead(ledPin)); break; case '*': digitalWrite(ledPin,!digitalRead(ledPin)); break; } break; case RELEASED: switch (key){ case '*':
http://arduino.cc/forum/index.php/topic,60028.0.html Pgina 3 de 6
22/09/11 21:50
digitalWrite(ledPin,!digitalRead(ledPin)); blink = false; break; } break; case HOLD: switch (key){ case '*': blink = true; break; } break; } }
Logged
Kotch
Brazil
Offline
o q vc precisa disto: #include "Password.h" #include "Keypad.h" Password password = Password( "1234" ); const byte ROWS = 4; const byte COLS = 4; char keys[ROWS][COLS] = { {'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, {'*','0','#','D'} }; byte rowPins[ROWS] = {2,3,4,5}; byte colPins[COLS] = {6,7,8,9}; Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); void setup(){ digitalWrite(13, LOW); Serial.begin(9600); keypad.addEventListener(keypadEvent); keypad.setDebounceTime(250); }
http://arduino.cc/forum/index.php/topic,60028.0.html
Pgina 4 de 6
22/09/11 21:50
void loop(){ keypad.getKey(); } void keypadEvent(KeypadEvent eKey){ switch (keypad.getState()){ case PRESSED: Serial.print("Digitado: "); Serial.println(eKey); switch (eKey){ case '#': guessPassword(); break; default: password.append(eKey); } } } putz que moleza hein?
Logged
Dualboot: Windows XP + FreeBSD 8.1 5 Arduinos duemilanove
Kotch
Brazil
Offline
Desculpa a pessoal mas faltou um pedao do cdigo, no final coloquem: void guessPassword(){ Serial.print("Verificando, aguarde... "); if (password.evaluate()){ Serial.println("Abrindo a porta "); // digitalWrite(13, HIGH); //ativa o solenoide delay(2000); digitalWrite(13, LOW); //desativa o solenoide password.reset(); //apaga a senha }else{ digitalWrite(13, LOW); Serial.println("PASSWORD INVALIDA"); password.reset(); //apaga a senha } }
Logged
Dualboot: Windows XP + FreeBSD 8.1 5 Arduinos duemilanove
http://arduino.cc/forum/index.php/topic,60028.0.html
Pgina 5 de 6
22/09/11 21:50
Pages: [1] Go Up
| Arduino Forum :: International :: Portugues :: Cofre eletronico com senha
previous topic
next topic
Jump to:
=> Portugues
go
2011 Arduino Forum: Powered by SMF 1.1.12 | SMF 2006-2009, Simple Machines LLC
Simple Audio Video Embedder
Enotify by CreateAForum.com
http://arduino.cc/forum/index.php/topic,60028.0.html
Pgina 6 de 6