Show Posts
Pages: 1 ... 21 22 [23] 24 25 ... 197
331  Using Arduino / Project Guidance / Re: Keypad door lock reset on: February 20, 2014, 12:45:18 am
Maybe this will help you. I don't expect you to have the libraries that are used in this sketch, its is merely just an example.

Code:
/*
 || @version 1.0
 || @author Andrew Mascolo
 ||
 || @description
 || Simple use of keypad, password and LCD
 */
#include <Keypad.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#define Password_Lenght 7 // Give enough room for six chars + NULL char

LiquidCrystal_I2C lcd(0x20,20,4);
char Data[Password_Lenght]; // 6 is the number of chars it can hold + the null char = 7
char Master[Password_Lenght] = "123456";
byte data_count = 0, master_count = 0;
boolean good;
char customKey;

const byte ROWS = 4;
const byte COLS = 3;
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};

byte rowPins[ROWS] = {
  2,3,4,5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {
  10,9,8}; //connect to the column pinouts of the keypad

Keypad customKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS); //initialize an instance of class NewKeypad

void setup(){
  lcd.init();// initialize the lcd
  lcd.backlight();
}

void loop()
{
  lcd.setCursor(0,0);
  lcd.print("Enter Password");
 
  customKey = customKeypad.getKey();
  if (customKey) // makes sure a key is actually pressed, equal to (customKey != NO_KEY)
  {
    Data[data_count] = customKey; // store char into data array
    lcd.setCursor(data_count,1); // move cursor to show each new char
    lcd.print(Data[data_count]); // print char at said cursor
    data_count++; // increment data array by 1 to store new char, also keep track of the number of chars entered
  }

  if(data_count == Password_Lenght-1) // if the array index is equal to the number of expected chars, compare data to master
  {
    if(!strcmp(Data, Master)) // equal to (strcmp(Data, Master) == 0)
      good = true;
    else
      good = false; 

    lcd.setCursor(0,0);
    delay(1000); // added 1 second delay to make the password completely show on screen before it gets cleared.
    if(good) // equal to (good == true)
    {
      lcd.clear(); //clear the screen for new message
      lcd.print("Password is good");
      delay(1000);
      lcd.clear(); // clear the screen for next use
      clearData(); // reset the array holding the user password
    }
    else
    {
      lcd.clear(); // same as above
      lcd.print("Password is bad");
      delay(1000);
      lcd.clear(); // same as above
      clearData(); // same as above
    }
  }
}

void clearData()
{
  while(data_count !=0)
  {   // This can be used for any array size,
    Data[data_count--] = 0; //clear array for new data
  }
  return;
}
332  Using Arduino / Programming Questions / Re: Store status of previous key pressed on: February 20, 2014, 12:18:22 am
You really can't figure it out?

  • Make a new variable, previous_key.
  • Set previous_key to NULL or -1.
  • Read the key press.
  • If key press does not equal previous_key (which it won't, the first time), update previous_key.
I'm sure you can figure the rest out from here.
333  Using Arduino / Programming Questions / Re: compile error with LiquidCrystal_I2C on: February 19, 2014, 09:57:51 pm
Could you provide a link to your exact Lcd?
334  Development / Other Software Development / Re: New TFT Extension Library on: February 19, 2014, 02:43:52 pm
As per PaulS's suggestion, the library now has a cpp file. The only downside now is, I use the older libraries so I have certain lines commented and uncommented,  but for someone else who is using the newer libraries UTFT and UTouch, you would need to comment and uncomment their particular lines. You will see what I mean if you look at the .h and .cpp files.
335  Development / Other Software Development / Re: New TFT Extension Library on: February 19, 2014, 10:42:38 am
Quote
Can you guarantee that your users will do that?
No, not at all. But if (Big if)  they do everything else fine, then the worst they will get is this:
Quote
CirclePad:14: error: redefinition of 'TFT_Extension<ITDB02, ITDB02_Touch> myTFT'
CirclePad:13: error: 'TFT_Extension<ITDB02, ITDB02_Touch> myTFT' previously declared here
However it would help greatly if the Arduino software had visible line numbers on the side.



Quote
Quote
What would be the better way? Make a .cpp file?
Exactly.

By making a cpp file, I would need to include the UTFT and UTouch libraries, as well as the older ITDB02 libraries, right? What about if someone doesn't have the older libraries, the compiler will want to know where they are.

I'll figure it out.
336  Development / Other Software Development / Re: New TFT Extension Library on: February 19, 2014, 09:46:30 am
Ok, I changed DIR = dir * 0.01745 + 1.57; to  DIR = dir * RAD_TO_DEG + HALF_PI;
Better yet:
Quote
double DIR = dir * RAD_TO_DEG;
  Cx = x1 + sin(DIR + deg * RAD_TO_DEG + PI) * rad;
.
.
.

Whats is wrong with the implementation? It seems to work just fine.

What would be the better way? Make a .cpp file?
337  Development / Other Software Development / Re: New TFT Extension Library on: February 18, 2014, 10:08:10 pm
OLD LIBRARY

UPDATE: I added the changeable colors for the Radio buttons and a new function fillTriangle. I also fixed the button functions and allowed the user to have two variations of each button function. This was done because some functions are faster than others under certain conditions but for the most part, they are identical.

To get faster touch responses, set Precision to LOW or to get more precise touch responses, set Precision to EXTREME.

Note: I am still trying to perfect the fillTriangle function, but is seems to be good enough. If anyone has a better solution to fill a triangle at a certain degree, please by all means share it.

I will try to finalize the library soon.
338  Using Arduino / Project Guidance / Re: Security System on: February 18, 2014, 07:17:59 pm
Its very simple actually, but I do not see anything that has to do with a keypad or a Lcd. If you "Search the Arduino Forum" for keypad password and LCD, you'll most likely find tons of information and examples.

We see these questions all the time, "I need help making a password" or "I want to enter a password with a keypad..."

Try doing a search first.
339  Using Arduino / Project Guidance / Re: Security System on: February 18, 2014, 06:16:49 pm
I stop reading when I got to
Quote
#define TRIGGER_PIN  6  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     7  // Arduino pin tied to echo pin on the ultrasonic sensor.

You said you have a 3 pin US range finder, yet the library your using needs the 4 pin US range finder. You need to change one of the two, either the code or the ping sensor.
340  Using Arduino / Project Guidance / Re: Arduino accelerometer bluetooth issues, please help!!! on: February 15, 2014, 11:18:20 pm
You should use Putty or Realterm instead of the serial monitor, and make sure the bluetooth module is wired properly. Tx to Rx and Rx to Tx.
341  Using Arduino / Project Guidance / Re: Arduino accelerometer bluetooth issues, please help!!! on: February 15, 2014, 09:58:56 pm
Could you provided the code your using?
342  Using Arduino / Programming Questions / Re: Running Graph display on TFT LCD on: February 15, 2014, 09:31:24 pm
You can use one of these TFT Lcds, LINK. It uses the UTFT and UTouch libraries, and it also has another library Ubuttons.

The UTFT library has a demo that shows a moving graph, that you can use your make you graph. It will require you to do some writing, because there is no Make_Graph_With_These_Values function.

I too have the Lcd.
343  Using Arduino / Project Guidance / Re: Arduino Motors not working on: February 15, 2014, 12:35:55 am
Pin 13 is connected to a resistor and Led so it may be giving you problems, however I don't see a pinMode for pin 3, and that could be the actual issue.
344  Using Arduino / Programming Questions / Re: Expected primary-expression before '||' token on: February 15, 2014, 12:30:34 am
Your missing parentheses in your IF statement. Right now, the IF statement is only seeing the first part, the stuff before the ||.

if( (condition1) || (condition2) ) // expected
if( condition1 ) || ( condition2 ) // what you have
345  Using Arduino / Project Guidance / Re: I am soooo lost!!!!!!!!! on: February 14, 2014, 11:11:48 pm
I just downloaded the TimerOne library then tried your code and it compiles fine.

Quote
I followed exacily what the book said for the sketch and got this ' Timer1' not declared in the sketch
Where exactly is the library, post the exact address. If you don't know how to get the address, find the TimerOne folder, highlight and right click to properties, the address is there. I am unfamiliar with MAC computers, so your on your own there.

Also, you don't need to have "TimerOne Timer1" as Robin2 suggested, because it is already declared in the library.
Pages: 1 ... 21 22 [23] 24 25 ... 197