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
Code:
    if(flag == 1) // If flag variable is 1, then it means the tags match
    {
      Serial.println("Matched!");
      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.

Quote
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?

Quote
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?

Quote
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
Code:
#if defined(RF69_COMPAT)
  volatile uint8_t* Data;
  volatile uint8_t* DataLen;
#endif
If the RF69_COMPAT value is defined, Data and DataLen are created as private members of the class.

Code:
#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;
#endif
Otherwise, they are defined as public members of the class.

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

Therefore, this:
Code:
     [b] for (byte i = 0; i < *radio.DataLen; i++) //can also use radio.GetDataLen() if you don't like pointers[/b]
        Serial.print((char)radio.Data[i]);
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
Quote
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
Quote
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
Code:
SoftwareSerial bleSerial(0, 1); // RX, TX
You can NOT do software serial on the hardware serial pins.

Code:
  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
Code:
      gsm.WhileSimpleRead();
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
Quote
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.

Quote
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
Code:
If i try to do it in a single line the arduino will explode.
Nonsense.

Code:
  Serial.begin(9600);
  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.

Code:
  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.

Code:
float latitude()//get latitude
{
  char i;
  char lat[10]={
    '0','0','0','0','0','0','0','0','0','0'
  };
 
 
  if( ID())
  {
    comma(2);
    while(1)
    {
      if(Serial.available())
      {
        lat[i] = Serial.read();
        i++;
      }
      if(i==10)
      {
        i=0;
        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.

Code:
      temp=temp*10+(data_buf[i++]-0x30);
Since the purpose of the subtraction is to convert 'n' to n, 'n' - '0' is MUCH more obvious.

Code:
    //process the data array
    while(data_buf[i]!='.')
      temp=temp*10+(data_buf[i++]-0x30);
Suppose that the array contains "12345.6789". When this gets done, temp will contain 1234.

Code:
    for(j=0;j<num;j++)
      temp=temp*10+(data_buf[++i]-0x30);
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?

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

Code:
  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
Quote
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
Code:
ISR(TIMER1_COMPA_vect){//timer1 256Hz
  Serial.println("E");
  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
Quote
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.

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

Quote
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
Quote
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.

Quote
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
Quote
What shields would you suggest?
I have this one:
https://www.sparkfun.com/products/10854

Using one of these:
https://www.sparkfun.com/products/8687
makes configuration so much easier.

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