Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: Don't receiving confirmation of the changes from the xbee on: April 25, 2012, 12:16:27 pm
Thanks rossb I put the ATWR command on the end of input and it worked well.
Thanks all of you guys, you helped me a lot.
2  Using Arduino / Networking, Protocols, and Devices / Re: Don't receiving confirmation of the changes from the xbee on: April 23, 2012, 07:38:09 am
I was thinking that we need to count the null character so i put 3, "o"+"k"+"NULL".
But now i changed to 2.
And the incomingchar is filled in with O+K so it became a String.
3  Using Arduino / Networking, Protocols, and Devices / Don't receiving confirmation of the changes from the xbee on: April 23, 2012, 07:02:57 am
   Hello guys, some time ago I did a post about of changing the power level of the xbee. Now I want to prove that changing.
   I'm using one xbee series 1 connected to one xbee shield and one arduino duemilanove.
   And I use one Xbee USB Xplorer to do readings on the X-CTU.

   I'm using the following code to change the power level of the xbee:

Code:
void setup ()
{
  Serial.begin(9600);
 
  Serial.print("X");
  delay(1100);
 
  Serial.print("+++");
  delay(1100);
   if (returnedOK() == 'T') {
  }
  else {
    setup();
  }
 
  while(returnedOK() != 'T'){
  Serial.println("ATPL 3");
  delay (1000);
  }
  Serial.println("ATPL");
  delay(1000);
 
  Serial.println("CN");

  }

void loop ()
{
 
 
}


char returnedOK () {
  char incomingChar[3];
  char okString[] = "OK";
  char result = 'n';
  int startTime = millis();
  while (millis() - startTime < 2000 && result == 'n') { 
    if (Serial.available() > 1) {
   
      for (int i=0; i<3; i++) {
        incomingChar[i] = Serial.read();
      }
      if ( strstr(incomingChar, okString) != NULL ) {

        result = 'T';
      } 
      else {
        result = 'F';
      }
    }
  }
  return result;
}

   As can be seen by the code I'm using the function returnedOK to test if the byte was received and continue the changes.
   But after all the steps have been completed, I disconnect the xbee from the shield and I connect the xbee to the USB xplorer and I look in the X-CTU to see the power level change. But that isn't changed (continues 4 - standard).
    I want to know why it isn't changing since I'm receiving the confirmation byte.
Thanks
4  Using Arduino / Programming Questions / [Error]Getting data from NunChuck on: April 04, 2012, 01:01:46 pm
hey guys, i'm trying to take the reading from a Wii Nunchuck joystick. I made a poor code, but i'm using the library in the Arduino 1.0, however i'm taking the same error everytime, and it says that Wire is not declared. Wire is declared into the nunchuck_funcs library, the only time that Wire is used is into the library, not in my code.

Here is the code

Code:
#include <Wire.h>
#include <nunchuck_funcs.h>
#include <Servo.h>

int accx,accy,x,y,zbut,cbut;
int ledPin = 13;

void setup()
{
 
  Serial.begin(19200);
  nunchuck_setpowerpins();
  nunchuck_init(); // send the initilization handshake
    
    Serial.print("WiiChuckDemo ready\n");
}

void loop()
{
  
  nunchuck_get_data();
  
  nunchuck_print_data();
  
  accx = nunchuck_joyx();
  
  accy = nunchuck_joyy();
  
  zbut = nunchuck_zbutton();
  
  cbut = nunchuck_cbutton();
  
  
delay (5);
  
  
}
5  Using Arduino / Networking, Protocols, and Devices / Re: Change Power Level Xbee (series1) on: April 04, 2012, 08:54:59 am
Faludi I tried to do one function to see if the xbee returns "OK" based on your code (char returnedOK () ).
But i'm still don't receiving the ok, and when I connect the xbee to the Xbee Xplorer USB to check in X-CTU if something have changed, I didn't see any change of the previously configuration.
The code is that:
Code:
void setup ()
{
  Serial.begin(9600);
 
  Serial.print("X");
  delay(1100);
 
  Serial.print("+++");
  delay(1100);
   if (returnedOK() == 'T') {
  }
  else {
    setup();
  }
 
  Serial.println("ATPL3");

  Serial.println("ATPL");

  }

void loop ()
{
 
 
}


char returnedOK () {
  char incomingChar[3];
  char okString[] = "OK";
  char result = 'n';
  int startTime = millis();
  while (millis() - startTime < 2000 && result == 'n') { 
    if (Serial.available() > 1) {
   
      for (int i=0; i<3; i++) {
        incomingChar[i] = Serial.read();
      }
      if ( strstr(incomingChar, okString) != NULL ) {

        result = 'T';
      } 
      else {
        result = 'F';
      }
    }
  }
  return result;
}

I'm really in doubt now if the xbee connected to an xbee shield could change your configurations without I have to use a Xbee Xplorer USB.
6  Using Arduino / Networking, Protocols, and Devices / Re: Change Power Level Xbee (series1) on: March 29, 2012, 07:32:20 am
I did the modiications on the code:
Code:
char str[5] = "OK";

void setup ()
{
  Serial.begin(9600);
 
  Serial.print("+++");
  delay(3000);
  if((int)Serial.read()==(int)str){
  Serial.println("ATPL");
  delay(1000);
  if(Serial.read()>=3){
  Serial.println("ATPL 2");
  delay(1000);
  Serial.println("ATPL");
  }
  }
}

void loop ()
{
 
 
}


Still... Not working =/
7  Using Arduino / Networking, Protocols, and Devices / Re: Change Power Level Xbee (series1) on: March 29, 2012, 07:10:43 am
Ok I will change that, but yet the command +++ is not returning the "OK", even if a only use that in void setup(), like it:

void setup()
{
Serial.begin(9600);
Serial.print("+++");
}

Checking it on T Term the command OK isn't returned.
8  Using Arduino / Networking, Protocols, and Devices / Re: Change Power Level Xbee (series1) on: March 29, 2012, 06:52:11 am
Ok that's still not working...
This is the code that I'm using now:

Code:
void setup ()
{
  Serial.begin(9600);
 
  Serial.print("+++");
  delay(3000);
  if(Serial.read()=='OK'){
  Serial.println("ATPL");
  delay(1000);
  if(Serial.read()>=3){
  Serial.println("ATPL 2");
  delay(1000);
  Serial.println("ATPL");
  }
  }
}

void loop ()
{
 
}

But I'm still note receiving the "OK" from the command "+++", and not receiving too the return of ATPL.
I listened to the returns too like you said. I really don't now what to do to this works.
9  Using Arduino / Networking, Protocols, and Devices / Re: Change Power Level Xbee (series1) on: March 28, 2012, 12:23:15 pm
Quote
Do you guys nows what's wrong with the code?
That code should be in setup(), or a function that gets called only as needed, not in loop().

The code talks to the XBee, but doesn't listen to the XBee. Why not?

The code isn't listening to xbee because this is only a prototype code, I'm using that just to learn how to use the AT commands in the source code. After I will do a complete code to my project
But thanks PaulS like always you helped me a lot.
10  Using Arduino / Networking, Protocols, and Devices / Re: Change Power Level Xbee (series1) on: March 28, 2012, 09:58:35 am
   I'm using the following code just to do some tests:

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

void loop ()
{
  Serial.print("+++");
  delay(4000);
  Serial.println("ATPL");
  delay(1000);
  Serial.println("ATPL 2");
  delay(1000);
  Serial.println("ATPL");
  exit(1);
}


   But that isn't working, because after I did the upload to arduino board and connected the xbee shield with the xbee and I open the X-CTU serial terminal to see if that's working.
   The terminal shows me the code but don't return me the "OK" after the "+++", the ATPL command is typed autonomous by arduino but doesn't work.
   Do you guys nows what's wrong with the code?
   Thanks

"Sorry for me english, is not my native language"
11  Using Arduino / Networking, Protocols, and Devices / Re: Change Power Level Xbee (series1) on: March 26, 2012, 05:39:25 pm
I'll do a test within the code using the Serial.read(), to see if the command was received correctly, and I will put the delay too.
And I'll do it on Wednesday because tomorrow I have a lot of classes.

But thanks PaulS, you were very helpful, helped me a lot.
12  Using Arduino / Networking, Protocols, and Devices / Re: Change Power Level Xbee (series1) on: March 26, 2012, 01:18:13 pm
Quote
How is the XBee communicating with the Arduino?
You didn't answer this question. I'll tell you - the communication is via Serial.print(), Serial.write(), Serial.println(), Serial.read(), and Serial.available().

So, yes, you can send +++ to the XBee, to put it into command mode, and then send it AT commands, using Serial.print().

Thanks PaulS
I will try this:
Serial.print(+++);
Serial.print(ATPL);
Serial.print(x); //4,3,2,1

I will tell you if it works.

If that's
13  Using Arduino / Networking, Protocols, and Devices / Re: Change Power Level Xbee (series1) on: March 26, 2012, 11:55:51 am
One of the Xbees is connected to the USB Xplorer that's connected to the computer. The second Xbee is connected to one Xbee Shield that's connected to one arduino duemilanove,being powered trough a external power supply (VIN/GND).
I want that the xbee that's connected to arduino/xbee shield could change your power level on an autonomous way to save power, decreasing the power level when signal is strong and increasing when signal is weak.
14  Using Arduino / Networking, Protocols, and Devices / Re: Change Power Level Xbee (series1) on: March 26, 2012, 07:47:20 am
But there's a way to send this AT command through source code?
Because I'm trying to do something autonomous, that don't need my interaction with serial communication.
15  Using Arduino / Networking, Protocols, and Devices / Change Power Level Xbee (series1) on: March 26, 2012, 07:18:20 am
Hello guys I want to change the power level of my xbees through source code to my college project.
I have 2 XBee 1mW Chip Antenna - Series 1 (802.15.4), one XBee Explorer USB and one arduino duemilanove connected to a XBee Shield.

I already now how to set the power level using the X-CTU software, but I want to change that through source code because my project is about power consumption of a wirelles network. So I want to now if there is a library or a function in one of the standard libraries that do the power level change.
I had found some old libraries that don't have the function that I'm looking for.

Thanks. 
Pages: [1] 2