Show Posts
Pages: 1 2 [3] 4 5 ... 3066
31  Using Arduino / Programming Questions / Re: Problem with my program with libraries adafruit_gps.h and SD.h on: Today at 08:09:05 am
Of course the second program works. It just doesn't produce the results that you want. What it does and what you want you kept to yourself, though, so we can't help you.
32  Using Arduino / Programming Questions / Re: rfid programming for attendance system on: Today at 07:40:01 am
    if(flag == 1) // If flag variable is 1, then it means the tags match
      state = !state; // Toggle state
      digitalWrite(13,state); // Apply the new state to the LED
Here, where you know that a tag matched the one known tag, you would need to record that you (the owner of the one good tag) were present.

How can i modify it to display present and absent students of a class.
Plural? How can than be, when the program only recognizes one tag/student?

I am new to programming .I tried with my limited knowledge. But never got proper result.
Why are you doing this project? Isn't it because you are trying to learn something about programming?

Its time for us to submit our work.
No, it's time to submit YOUR work, not our work.
33  Using Arduino / Programming Questions / Re: error compiling RFM12B send/receive example on: Today at 07:34:32 am
#if defined(RF69_COMPAT)
  volatile uint8_t* Data;
  volatile uint8_t* DataLen;
If the RF69_COMPAT value is defined, Data and DataLen are created as private members of the class.

#if !defined(RF69_COMPAT) //don't hold the same values in COMPAT mode, so use the accessor functions
    volatile uint8_t* Data;
    volatile uint8_t* DataLen;
Otherwise, they are defined as public members of the class.

#define RF69_COMPAT 1
By default, the data is private.

Therefore, this:
     [b] for (byte i = 0; i < *radio.DataLen; i++) //can also use radio.GetDataLen() if you don't like pointers[/b]
will not work, and you'll have to use the GetDataLen() and GetData() methods.

By the way, don't try to bold stuff in a code window.
34  Using Arduino / Programming Questions / Re: Getting a 4-digit number from a keypad on: Today at 07:02:59 am
After recognising a key press you must wait until no keys are pressed
This assumes that the code is waiting for a key to be pressed. It is not.

OP: On any given pass through loop(), you have to determine if a key is pressed. If not, do nothing. If it is, add it to the array, in the proper place.

Of course, this means that you need to keep track of how many keys have been pressed.

There are some other things you should do. Do NOT assume that the password is exactly 4 characters. Of course, this means that you need some way to indicate that the password has been fully entered. You also need a backspace mechanism, in case the user makes a mistake, and wants to undo the last keypress. Fortunately, you DO have to other keys that could mean enter and backspace.
35  Using Arduino / Programming Questions / Re: Need help with making a password circuit + writing code on: Today at 06:51:36 am
So, I decided to try to make a basic password circuit
A password is a software concept.

You don't have resistors on the switches, so they are floating. Use the internal pullup resistors, so that pressed is LOW, or add external resistors.

loop() doesn't wait for switches to be pressed. Resetting the password instance on every pass through loop is not a good idea.

What if the password is 1, 2, 3, 4, and you press 1, 2, and 2 accidentally. You don't have a reset or backspace plan.

You should do something more than print true or false, based on the return value from evaluate().
36  Using Arduino / Programming Questions / Re: How to grab responses from Serial Terminal? on: Today at 06:45:31 am
SoftwareSerial bleSerial(0, 1); // RX, TX
You can NOT do software serial on the hardware serial pins.

  Serial.begin(115200);   //initial the Serial
Especially not while also trying to do hardware serial on the same pins.

Get over it.
37  Using Arduino / Programming Questions / Re: get message form tcp server on: Today at 06:07:18 am
What does this do? It implies that it reads something, which implies that it should return (or at least output somehow) what it read. If it returns something, why don't you print it?

What does the code actually do? What do you expect it to do?
38  Using Arduino / Programming Questions / Re: get message form tcp server on: Today at 05:59:31 am
Hi, i use SIM900 libary and i want get message from TPC arduino server
All the words are spelled correctly, but the semantic content is still NULL.

What does TPC mean? Where is your code?

If the SIM900 library is used with the SIM900 chip on a shield on the Arduino which is acting as a server, it isn't clear why you are having a problem getting a message.

so.. i juse this command with PHP
Is PHP really running on your Arduino? If so, can you post a reply detailing exactly how you got the PHP engine to run on the Arduino, and which Arduino you managed that for?
39  Using Arduino / Programming Questions / Re: Arduino Uno with GPS TEL0051 V3.0 on: Today at 05:51:39 am
If i try to do it in a single line the arduino will explode.

  delay(5000);//GPS ready
Waiting for the hardware to be powered up is one thing. Waiting for the GPS to have acquired satellites and actually received a fix are two completely different things.

  initdistance=calc_dist(latitude(),longitude(), inputlon, inputlat);// input long and latitude
  initbearing=calc_bear(latitude(),longitude(), inputlon, inputlat);// initial bearing and distance
  float dynbearing=initbearing;
  float dist=initdistance;
Declaring local variables that immediately go out of scope isn't useful.

float latitude()//get latitude
  char i;
  char lat[10]={
  if( ID())
        lat[i] =;
        float lat1=Datatransfer(lat,5);
        Serial.println(lat1,5);//print latitude
        return lat1;
There is so much wrong here that it's hard to know where to begin.

This function calls ID() which might return 0 in a char. Stupid, really, as ID should return false in a boolean. Regardless, if ID() doesn't return true, this function ends WITHOUT returning anything. Bullshit.

Since the purpose of the subtraction is to convert 'n' to n, 'n' - '0' is MUCH more obvious.

    //process the data array
Suppose that the array contains "12345.6789". When this gets done, temp will contain 1234.

Then, you skip the decimal place, and read and process 5 of the next 4 characters. Nonsense.

Your Datatransfer function is an attempt to reinvent atof(). Why?

Why do you ASSUME that the GPS will return a specific number of digits after the decimal point?

Why do you assume that there are exactly 10 characters in each field of the $GPGGA sentence?

Why do you assume that there will be exactly 10 characters after the second comma that represents latitude? Why do you assume that every one of those 10 characters is either a decimal point or a character that represents a digit?

void loop(){
int motor = 0;
int motor2= 1;
The loop() function does NOT take arguments.

  if(float dist =! 0 )
declaring a local variable, with no initial value, and then comparing that to a specific value is stupid.

It's no wonder why you don't get valid data, given all of the assumptions you are making but not validating.
40  Using Arduino / Programming Questions / Re: Creating a Web Server: Multiplexer & Ethernet Shield on: Today at 05:07:52 am
I have written the following code but it doesn't work.
Assuming that the code you pasted doesn't actually look like that, it DOES work. It just doesn't do what you want. But, without knowing what it ACTUALLY does, and without knowing what you want it to do, we don't have a snowballs chance in hell of helping you.
41  Using Arduino / Programming Questions / Re: MPU6050 and Timer1 conflict on: Today at 04:56:19 am
ISR(TIMER1_COMPA_vect){//timer1 256Hz
  timer_sw = 1;
Interrupts are disabled during an interrupt service routine. Doing things in the ISR that rely on interrupts being enabled is stupid. Stop doing it.

42  Using Arduino / Programming Questions / Re: changing program to read data from 3 sensors on: Today at 04:35:46 am
1- If I connect more than 1 pressure sensor to the board, is it necessary to change the program?
That depends on what the program currently does.

2- is it possible to change it easily?
Sure. All you need is an editor. The IDE just happens to include one.

3- is there any ready program that I can just replace with the existed one in EPROM of the board to fulfill my need?
No. If you don't intend to learn to program, don't buy the Arduino.
43  Using Arduino / Programming Questions / Re: About that *pt2Function thing on: Today at 04:32:51 am
Is *pt2Function the name of something important
In what context?

I'd guess that the name means something like "pointer to function", in which case you supply the name (which the compiler translated to address) of the function you want to be called.

or can I use any name, like *callback?
If you do, I'll personally come kick your ass. Use a name that defines what the function does, not some stupid generic name that means nothing.
44  Using Arduino / Programming Questions / Re: Struct return in Library on: Today at 04:27:52 am
Wrapping an array in an struct is not the best way to return an array from a function. If the array is statically sized in the struct, the caller should create the array, and pass a reference to it to the function that needs to populate it.

So, why are you wrapping the array in a struct?

If you must, define the struct in a header file, included in the library and the sketch.
45  Using Arduino / Programming Questions / Re: Arduino Uno & ZigBee RC HELP NEEDED. making it wireless on: April 16, 2014, 01:53:05 pm
What shields would you suggest?
I have this one:

Using one of these:
makes configuration so much easier.

Hey, it's only money.   smiley-cool
Pages: 1 2 [3] 4 5 ... 3066