Show Posts
Pages: 1 ... 1888 1889 [1890] 1891 1892 ... 3270
28336  Using Arduino / Networking, Protocols, and Devices / Re: Newbee Xbee connection on: March 22, 2012, 07:07:19 am
Series 1 radios are point to point - two XBees talking to each other.
Series 2.5 radios are mesh network - a bunch of XBees passing data back and forth.

You want the Series 1 models.

The Pro versions consume more power, but the tradeoff is that they transmit further. Even the regular models are good for 300 feet.

Quote
2AA battery 5V to 5V Step Up
Don't. Get 4AA and run the Arduino/XBee properly. The batteries will last far longer, and there will be one less piece of hardware to deal with.

Quote
9V battery adapter
As long as that adapter lets you use 4AA batteries, it's a good choice.
28337  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield and differentiating between clients on: March 22, 2012, 06:45:11 am
Quote
Also, when engineering stuff, you have to think in terms of what you want to do, and not be limited by what you think the hardware can do.
So, it's OK to connect a 200 Amp starter motor to my Arduino digital pin, because I don't want to "be limited by what you think the hardware can do"? What a load of crap.
28338  Using Arduino / Networking, Protocols, and Devices / Re: Xbee Communication with my PC on: March 22, 2012, 06:41:58 am
Quote
I don't know what the "USB" setting is for, but I am avoiding it for now.
The USB setting is so that you can upload sketches to the Arduino without having to remove the XBee shield.
28339  Using Arduino / Networking, Protocols, and Devices / Re: data arrives, but always the same. Digimesh on: March 22, 2012, 06:37:22 am
Code:
DMTxRequest tx = DMTxRequest(addr64, payload, sizeof(payload));
You are creating an instance of the DMTxRequest class, giving it the data currently in payload.

Code:
      pin5 = 140; /what I send
      payload[0] = pin5 >> 8 & 0xff;
      payload[1] = pin5 & 0xff;
Now, you put new data in payload.

Code:
      xbee.send(tx);
Now, you send the object that has the old data.

I'm not particularly surprised that you never get any new data.

P.S. It's hard to believe that that code even compiles, given that half-assed comment.
28340  Using Arduino / Storage / Re: Creating numbered files on an SD card on: March 22, 2012, 06:27:02 am
Quote
Just for understanding though, can you explain what the  + '0'  is for?
1 is a number. '1' is a character. The name of the file is an array of characters. The ASCII values corresponding to the numbers 0 to 9 are consecutive. So, to convert a number between 0 and 9 to a character, all you need to do is to offset from '0'.
28341  Using Arduino / Interfacing w/ Software on the Computer / Re: Communication with MATLAB_Old Questions But New Ideas on: March 22, 2012, 06:20:01 am
I didn't find any of the poll choices appealing, so I didn't vote. Sorry.
28342  Using Arduino / Interfacing w/ Software on the Computer / Re: interfacing with the pulse oximeter...!! on: March 22, 2012, 06:17:22 am
If you have "the pulse oximeter", you are on your own. If you have "a pulse oximeter" and you share a link to the device, you might get help.
28343  Using Arduino / Programming Questions / Re: easyVR with Ethernet on: March 22, 2012, 06:14:14 am
Quote
Can i use other pi to communicate ?
To communicate from what to what?

You need to post a link so we are all looking at the same thing/documentation.
28344  Using Arduino / Programming Questions / Re: easyVR with Ethernet on: March 22, 2012, 05:57:15 am
Quote
Then there's your problem.
That's only one of the problems. The Ethernet shield uses SPI to communicate with the Arduino, on pins 11, 12, and 13.

The Ehternet shield and that shield are simply incompatible, if you (try to) use pins 12 and 13.

Of course, using the hardware serial pins will cause other issues.
28345  Using Arduino / Programming Questions / Re: Function to make arduino sample a sensor every 20 min on: March 22, 2012, 05:42:17 am
Or, there is the "Blink Without Delay" example to look at. Instead of turning an LED on or off, you would be reading a sensor.
28346  Using Arduino / Programming Questions / Re: easyVR with Ethernet on: March 22, 2012, 05:24:03 am
Quote
i have a problem with the ethernet and the easyvr Shield.
"the ethernet (shield)" is a common commodity. "the easyvr Shield" is not.

Post a link to it is you expect us to determine what pins it uses, and what conflicts there are with the other pins you are using.
28347  Using Arduino / Programming Questions / Re: IR signals to MIDI output via USB on: March 22, 2012, 05:14:41 am
Code:
    if(results.value == powerValue || powerValueB)
What do you think this is doing? It almost certainly isn't.

Code:
          // Send on note
          for(note = 30; note < 50; note ++)
          {
            noteSend(0x09, 0xB0, 0x08, 0x7F);
            digitalWrite(3, LOW);
            digitalWrite(5, HIGH);
            digitalWrite(6, HIGH);
          }         
The "on" note needs to be send 20 times? Why are you starting the loop at 30, as opposed to 87, or the more logical 0?

Code:
          // Send off note
          for(note = 30; note < 50; note ++)
          {
            noteSend(0x09, 0xB0, 0x08, 0x00);
            digitalWrite(3, HIGH);
            digitalWrite(5, HIGH);
            digitalWrite(6, LOW);   
          }
Same question.

Code:
unsigned long powerValue = 0x800F840C;
unsigned long powerValueB = 0x800F040C;
I prefer a sense of symmetry in my variable names, like powerValue1 and powerValue2 or powerValueA and powerValueB. YMMV.
28348  Using Arduino / Programming Questions / Re: What is the Arduino Uno Serial buffer size? on: March 22, 2012, 04:56:18 am
Quote
But there is no point in displaying it until all 107 bytes have arrived.
Not only is there no point in doing it, there is harm in doing it. It takes time to do the output, and, with the incoming stream of data that you have, time is something you don't have a lot of.

Variable names like q are easy to type, but they don't mean diddly. They are fine for loop indices, but not the way you are using them. Do yourself a big favor and use meaningful names.
28349  Using Arduino / Programming Questions / Re: Using two FSRs on a timer to switch videos on: March 22, 2012, 04:45:29 am
Code:
   int valclub = map(analogRead(clubPin), 0, 1023, 0, 255);
The map function is overkill for dividing a value by 4.

Code:
   delay(10);
Why?

The Arduino is firing off a steady stream of values, every 10 milliseconds. It seems to me that you would want to send a value only when the value signified that an event occurred, like the ball was hit or the ball hit the cup. Of course, you would then need some way for Processing to distinguish what those values meant. Perhaps, it would be better if the club sent a letter, like 'W' whenever it whacked a ball, and the cup would send a 'C' when it caught the ball (if there is only one cup, or a number (different for each cup) if there is more than one cup)).

Your Processing sketch needs some work, too.
Code:
  float[] colors = float(split(inString, ","));
The string being sent by the Arduino now consists of a single int. Why are you converting this to an array of floats?
28350  Using Arduino / Programming Questions / Re: I need help with a little code entry pad. on: March 22, 2012, 04:34:35 am
Code:
  if(y > 3){
    for(x=0;x<1;x++){
      attempt[x] = 0;
    }
    y=0;
  }
So, how many times does that loop execute? Which elements of the array are you resetting?

Do your self a favor. Add some #define statements to the top of your code to define some names:
Code:
#define BTNCNT 9
#define ATTCNT 2

Then, use these names when you declare arrays:
Code:
byte buttons[BTNCNT] = {2,3,4,5,6,7,8,9,10}; //Set buttons to array
byte pass[ATTCNT] = {2,3}; // Set password
byte attempt[ATTCNT]; // Set attempts array
byte state[BTNCNT]; // Make states array
byte oldstate[BTNCNT]; // When button is hit, info added here

This will ensure that all arrays are properly sized.

Then, use these names in loops, and other places, too:
Code:
  for(x=0; x<BTNCNT; x++)
  {
    pinMode(buttons[x], INPUT);
  }
Code:
  for(x=0; x<ATTCNT; x++)
  {
    if(attempt[x] == pass[x])  // <== Fixed these, too
    {
      Correct();
    }
  }

Also, think about what are reasonable values for the limit conditions:
Code:
  if(y > 3)
{
Since this test will be false until y is 4, it means that y=0, y=1, y=2, and y=3 are good values, and that attempt[3] is a good place to write to. As currently structured, it is not. If you tested for y>=ATTCNT, the test would limit the index to the maximum that is valid for the array.

Changing the value associated with ATTCNT from 2 to 4 to 12 then requires no other code changes to create and accommodate larger arrays.
Pages: 1 ... 1888 1889 [1890] 1891 1892 ... 3270