Loading...
  Show Posts
Pages: [1] 2 3 ... 2363
1  Using Arduino / Programming Questions / Re: client.connect() causing watch dog trip. on: May 17, 2013, 06:22:49 am
Quote
Can I reference millis() in this section of code?
Yes. Typically, if you are adding a condition to a while statement, the addition goes on the end, not the beginning.
2  Using Arduino / Programming Questions / Re: Web server, How to make a simple button to reset a counter?? on: May 17, 2013, 06:16:59 am
Quote
I am not very good with all the terminology, Especially with this web server stuff as I have never done it before.
Imagine that you work in a fast food restaurant.

A client comes in, and orders a chicken sandwich and onion rings. You cook a cheeseburger and french fries.
The next client wants a tuna sandwich and cole slaw. You cook a cheeseburger and french fries.

See a problem? The "You get it our way!" sign needs to be prominently displayed (right next to the going out of business sign).

Actually paying attention to what the client wants is a good thing.
3  Using Arduino / Programming Questions / Re: SMS Shield + Flame Sensor: Can`t work together on: May 17, 2013, 06:09:51 am
You have two programs that work, so you posted them. You have one that doesn't, so you didn't post it. But, it is that code that we are to use our psychic powers on, and help you fix.

Good luck with that.
4  Using Arduino / Programming Questions / Re: Same code works and it doesn't on: May 17, 2013, 06:05:53 am
Code:
  Wire.requestFrom(DEVICE_ADDRESS, 1);

  uint8_t test;
  while (Wire.available()) {
    test = Wire.read();
  }
While I2C is fast, you seem to be under the mistaken impression that it is instantaneous. When you get over that, I predict you'll have better results.

Instituting callbacks, to be called when the data IS available is preferred. Not discarding results, in case the slave has a better idea how much data to return is preferred, too.
5  Using Arduino / Programming Questions / Re: Arduino PreProcessing. on: May 17, 2013, 05:59:23 am
Quote
I need to get the pure C code and then compile it.
First, you misspelled C++.

Second, compiling the code is not sufficient. You must also link it for the appropriate Arduino and upload it to the Arduino. Is your tablet capable of those last two steps?
6  Using Arduino / Programming Questions / Re: client.connect() causing watch dog trip. on: May 16, 2013, 02:42:18 pm
Quote
Is there a way to modify the time out for connect()?
The code for the connect method that actually gets used:
Code:
int EthernetClient::connect(IPAddress ip, uint16_t port) {
  if (_sock != MAX_SOCK_NUM)
    return 0;

  for (int i = 0; i < MAX_SOCK_NUM; i++) {
    uint8_t s = W5100.readSnSR(i);
    if (s == SnSR::CLOSED || s == SnSR::FIN_WAIT || s == SnSR::CLOSE_WAIT) {
      _sock = i;
      break;
    }
  }

  if (_sock == MAX_SOCK_NUM)
    return 0;

  _srcport++;
  if (_srcport == 0) _srcport = 1024;
  socket(_sock, SnMR::TCP, _srcport, 0);

  if (!::connect(_sock, rawIPAddress(ip), port)) {
    _sock = MAX_SOCK_NUM;
    return 0;
  }

  while (status() != SnSR::ESTABLISHED) {
    delay(1);
    if (status() == SnSR::CLOSED) {
      _sock = MAX_SOCK_NUM;
      return 0;
    }
  }

  return 1;
}
You'd need to add a timeout to the last while loop to not block forever.
7  Using Arduino / Programming Questions / Re: Logic Programming Problem on: May 16, 2013, 02:37:34 pm
The next step is to understand how to name states as well as form items, so you get back led1=on, led2=off, etc.
8  Using Arduino / Programming Questions / Re: DateFormat on: May 16, 2013, 02:30:22 pm
Quote
Which library should I include?
Probably not the MIDI library. A clue would be helpful. Something that caused you to believe that such a library exists, for instance.
9  Using Arduino / Programming Questions / Re: Reading encoder gives very strange results using the encoder library on: May 16, 2013, 02:04:51 pm
Quote
So, could anybody please tell me what goes wrong?
No. What is that output supposed to be telling anybody? A bunch of names followed by a bunch of values? It would make more sense to output name = value pairs, AND show the code where the name = value stuff gets printed.

Using names like _input and input in the same code shows a clear lack of design. No variable should EVER be named input. Doing so means that you haven't a clue WHAT the input is, which means that haven't a hope of solving a real-world problem. Sorry to be so harsh, but sometimes life just is that way.

There is no need to resort to names like _input and input, for any reason. If you REALLY think you need to, then call them local_input and class_input, just to illustrate that you can't think of better names.
10  Using Arduino / Programming Questions / Re: "Does not name type" SwitecX25 library on: May 16, 2013, 01:49:58 pm
Quote
:facepalm: It took me writing out this reply to remember that I have to "unhide" the file extensions to be able to manipulate them
That has got to be, beyond a shadow of a doubt, the absolutely dumbest idea Microslop EVER had. No one else thinks that hiding extensions is even remotely close to a good idea.
11  Using Arduino / Programming Questions / Re: error: unknown escape sequence '\c' problem on: May 16, 2013, 01:47:07 pm
Quote
Maybe i should search for a USB-COM port sniffer but i would like to see it realy happening in my Arduino
As has been suggested, printing the HEX value is the most useful thing to do.

You should forget that the LCD.write() function exists. For all intents and purposes, it will do nothing but screw with your LCD. Don't use it.

Printing "<cr>" or "<lf>" or "<shit if I know>" makes sense. Attempting to make stuff happen using escape characters OR forward slashes is a waste of time. Don't bother.
12  Using Arduino / Programming Questions / Re: PWM signaling VICTOR888 motor controller problem on: May 16, 2013, 01:42:51 pm
Quote
Is there any method to generate PWM signals in arduino ??
Of course. That is what analogWrite() does.

Quote
I would also like to know how to calibrate victor888 using arduino??
First, you post a link to the hardware...

If the Victor 888 is an ESC, then the Servo class will be useful.
13  Using Arduino / Programming Questions / Re: I must be blind... don't see why it doesn't work on: May 16, 2013, 01:40:13 pm
Quote
if toPrintToLCD == textOnLCD then no need to print.
Be sure to compare centered text to centered text, or un-centered text to un-centered text.
14  Using Arduino / Programming Questions / Re: How to take value of two variables get with arduino. on: May 16, 2013, 08:05:55 am
I'd suggest finding a dictionary, and look up the definition of all.
15  Using Arduino / Programming Questions / Re: client.connect() causing watch dog trip. on: May 16, 2013, 07:55:55 am
Quote
I guess I am wondering if there is any way to modify this of some library to time out when it cant make a connection.
Modify "this" what? The EthernetClient::connect() method DOES time out if a connection can not be made. It may not time out soon enough for you. In which case, I advise not hard-coding a bad domain name.  smiley-cool
Pages: [1] 2 3 ... 2363