Show Posts
Pages: 1 ... 39 40 [41] 42 43 ... 196
601  Using Arduino / Project Guidance / Re: 12 digit Keypad-controlled lock not working on: January 05, 2014, 07:42:39 pm
It shows it in the link I gave you.
602  Using Arduino / Project Guidance / Re: 12 digit Keypad-controlled lock not working on: January 05, 2014, 07:41:43 pm
That means your wires are wrong.
603  Using Arduino / Project Guidance / Re: 12 digit Keypad-controlled lock not working on: January 05, 2014, 07:38:16 pm
Quote
Also problems occur i.e., 3 isn't 4 in computer is it????? or # isn't 0?
What?
604  Using Arduino / Project Guidance / Re: 12 digit Keypad-controlled lock not working on: January 05, 2014, 07:36:03 pm
Take a look at the Procedure section. Here is the link HERE.
The picture that came up with the link you gave us, only showed 7 pad, so it should be the first 3 pads are for the COL, and the rest are your ROW pins
605  Using Arduino / Project Guidance / Re: 12 digit Keypad-controlled lock not working on: January 05, 2014, 07:21:34 pm
We don't know what keypad you have, so we cant tell what pins to use.
606  Using Arduino / Project Guidance / Re: 12 digit Keypad-controlled lock not working on: January 05, 2014, 07:16:43 pm
What keypad do you have, can you provide any links or pictures?
607  Using Arduino / Project Guidance / Re: Arduino + Bluetooth + Android + Motors on: January 05, 2014, 07:11:26 pm
How are you going to aid us? Looks like we need to aid you. Do you have any code you can show us?
608  Using Arduino / Programming Questions / Re: Creating my own library on: January 05, 2014, 07:00:47 pm
I decided to do some of the work for you, just so you can compare yours to mine.

New .h file:
Code:
//botoes.h

/*
botoes.h
Biblioteca para controles dos botoes no projeto da "Casa Inteligente"
Por: João Pedro Rodrigues, Janeiro, 2014

Edited by HazardsMind
*/

#ifndef botoes_h
#define botoes_h

#include "Arduino.h"
#define MaxButtons 10

class botoes
{
public: 
           // constructor
botoes(byte *buttonPins, byte Num_of_buttons);

          // method
bool clicou(int x);
private:
int _b;
int botao[MaxButtons];
};

#endif

New .cpp file:
Code:
// botoes.cpp

#include "Arduino.h"
#include "botoes.h"

botoes::botoes(byte *buttonPins, byte Num_of_buttons)
{
  for (int i = 0; i < Num_of_buttons; i++)
  {
    pinMode(buttonPins[ i ], INPUT);
    botao[ i ] = buttonPins[ i ];
  }
}

bool botoes::clicou(int x)
{
int UltEstado[7] = {0,0,0,0,0,0,0};
if(digitalRead(botao[ x ])!= UltEstado[x])
{
if(digitalRead(botao[ x ])== HIGH)
{
delay(50);
return true;
}
}
return false;
}

New Sketch:
Code:
#include <botoes.h>

byte myButtons[2] = {2, 3}; // you can set what pins you want to use as button, just make sure you tell it how many buttons you are using. In this case, I said pins 2 and 3, and i'm using 2 buttons total

botoes myToes(myButtons, 2); // Button pins and number of total buttons

void setup()
{
  Serial.begin(9600);
}

void loop()
{
   if (myToes.clicou(0))  // 0 = button on pin 2,    1 = button on pin 3
   {
    Serial.println ("Clicou");
   }
}
609  Using Arduino / Programming Questions / Re: Creating my own library on: January 05, 2014, 06:15:54 pm
Im not surprised.

botao(); // .h                     => should be botoes to match your CLASS and what is written in your .CPP file
botoes::botoes()  // .cpp
botao botao(); // sketch

Again, Not how to write it.
Quote
byte b[0]=50, b[1]=49, b[2]=48, b[3]=47, b[4]=46, b[5]=45, b[6]=44;

You want this. byte b[7] = { 50,49,48,47,46,45,44};

Quote
if (clicou(b[0])
this here needs another closing parenthesis.

Sketch:
Quote
#include " botoes.h"
botoes myToes() // or something
.
.
.
if ( myToes.clicou( 0 ) ) // 0 = button on pin 50
.
.
.
610  Using Arduino / Project Guidance / Re: Problem with if statements in program on: January 05, 2014, 05:39:03 pm
Your code needs formatting. Aside from that, program#1 encapsulates everything, even program#2. So how can program#2 run if program#1 is not?. Check your closing brackets for program#1, and get rid of one of the closing brackets at the end of the code, you have 4, where you only need 3.

Quote
if(digitalRead(switch1Pin) == HIGH && digitalRead(pirPin) == HIGH)  //Program#1
{ 
    digitalWrite(focusPin, HIGH);   
    delay(200);
    digitalWrite(focusPin, LOW);
    delay(1000);
    digitalWrite(focusPin, HIGH);
    delay(1000);
    digitalWrite(shutterPin, HIGH);
    delay(200);
    digitalWrite(focusPin, LOW);
    digitalWrite(shutterPin, LOW);
    delay(15000);
}
611  Using Arduino / Project Guidance / Re: Arduino bluetooth and usb scale on: January 05, 2014, 04:49:16 pm
Yea it's doable, but sending the data to a table or smart phone will be a little complicated. The Arduino mini should do fine and the bluetooth module should work too. As for what BT module you should get, I recommend a JY-MCU Slave module. HERE.

I also took a lot at your sensor and I didn't see any sample codes, so Im not sure how if it will work with just a simple analogRead or not.
612  Using Arduino / Programming Questions / Re: Creating my own library on: January 05, 2014, 04:19:53 pm
This
Quote
b0=50, b1=49, b2=48, b3=47, b4=46, b5=45, b6=44;

And this,
Quote
pinMode(b[0], INPUT);
   pinMode(b[1], INPUT);
   pinMode(b[2], INPUT);
   pinMode(b[3], INPUT);
   pinMode(b[4], INPUT);
   pinMode(b[5], INPUT);
   pinMode(b[6], INPUT);
Are not the same. You want byte b[7] = { /*button pins here */}, use byte instead of int, byte saves memory.

Why use UltEstado
  • if your not going to update it? All you need is if(botao
    • )[/b]. Another thing you should look into is Button Debouncing. There is an example sketch given to you in the Arduino software, learn how it works.

      There is more, but well get to that when you take care of everything above.
      You can also condense all you pinModes into a FOR loop
613  Using Arduino / Project Guidance / Re: 12 digit Keypad-controlled lock not working on: January 05, 2014, 03:57:09 am
There is nothing wrong with your code, so it could be your wiring to your keypad that may be the problem. If everything is wired correctly and the baud rate on the serial monitor (located in the bottom right corner) matches the BR in your code, enter this *123456#.
614  Using Arduino / Programming Questions / Re: !!! Push Button Counter !!! EASY ANSWER PLEASE HELP on: January 04, 2014, 11:47:42 pm
You should really use an array for your 7 seg display. 1 byte per number should work with the aid of the bitRead function and a simple FOR loop.

The second button should be self explanatory, I already gave you one example, now do the same for the second button BUT make sure you change the variables to distinguish both buttons. The variables are ButtonState and lastState, make sure you can tell the difference between the buttons.
615  Using Arduino / Programming Questions / Re: !!! Push Button Counter !!! EASY ANSWER PLEASE HELP on: January 04, 2014, 09:39:12 pm
Here is a very simple example of a button used to increase a counter, and change the brightness of a LED. I'm sure you can figure out how to set up two more buttons and have one decrease the counter and the other clear the counter.

Code:
const byte LED = 6;
const byte Button = A0;

byte ButtonState;
byte lastState = LOW;
byte count = 0;

void setup() {
  Serial.begin(9600);
  pinMode(LED, OUTPUT);
  pinMode(Button, INPUT);
}

void loop() {
  ButtonState = digitalRead(Button);

  if(ButtonState && ButtonState != lastState)  // button latch, no debounce needed.
  {
    if(count < 255) // This will check to see if the count is within a range of 0 - 255, and anything over that, it will reset count back to 0. Of course, this will happen anyways because count is a BYTE, and not an int or any other type.
      count += 5; // same as count = count + 5;
    else
      count = 0;
     
    analogWrite(LED, count);
    Serial.println(count);
  }
  lastState = ButtonState;
}

Pages: 1 ... 39 40 [41] 42 43 ... 196