Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Project Guidance / Re: clock with multiple alarms on: July 31, 2014, 11:15:35 am
the msg string gives me the right value/output on the serial monitor.

do i change the value of the string to ints? and then assign the ints to the correct position(eg hourstart1, minutestart1, hourstop1, minutestop1). thats were i get stuck. maybe you could point me to an tutorial?

i am so sorry, i am afraid i cant help.

2  Using Arduino / Project Guidance / Re: clock with multiple alarms on: July 31, 2014, 09:13:57 am

could you maybe help me find were the problem is and maybe how to fix that?

above is serial monitor output when i give it a time like 12341234

i dont know how to fix that, sorry. smiley-sweat
try to check yor msg variable using serial.print.
if the serial output gives the right value, then you need to adapted the working code to set the alarm

3  Using Arduino / Project Guidance / Re: clock with multiple alarms on: July 31, 2014, 01:08:06 am
check your 'val' variable using serial.print
does the val variable has the same with the number that you sent?.

Code:
int getIntFromAscii(int nbrDigits)
{
    YunClient client = server.accept(); //check new clients

  int val = 0;
  for(int i=0; i < nbrDigits; i++) {
    val = (val *10) + client.read()- '0';
[u] Serial.println (val);[/u]
  }
  return  val;
}

4  Using Arduino / Project Guidance / Re: clock with multiple alarms on: July 26, 2014, 09:51:43 pm
how you send it (IXXXXXX)?  and what is for?
why the alarmNumber == 4?

why Mstart and Mstop in integer?
Code:
void setAlarmPINTERVAL( time_t alarmNumber, const int MStart, const int MStop)

Quote
is there a possibility that it takes minutes instead.

yes. my code also take minute as input, just try to adapted from it.
5  Using Arduino / Project Guidance / Re: clock with multiple alarms on: July 26, 2014, 11:56:41 am
the problem before it is caused by enable/disable the timer.
the another problem shows up: clearing the previously set alarms, so from this post:
When set Timer get their AlarmID_t like this:

AlarmID_t aTimer = Alarm.timerRepeat(10, RepeatTest);

and then when you want to unschedule just disable/free (I am not test what is happening if you not disable before free it but for safe just disable and free) like this:

Alarm.disable(aTimer);
Alarm.free(aTimer);

we have to disable and set the alarm free.

hope this code below works for you

Code:
#include <Time.h>
#include <TimeAlarms.h>

//Serial data parsing RTC Function
#define TIME_MSG_LEN  11  
#define TIME_HEADER  'T'  
//===========end============
//Serial data parsing for ALARM
#define PJG_DATA 25
#define INT_SLAVE 'I'
//===========end============

//==Serial Variable for ROOM 1==
byte hourStart1 = 0;
byte minuteStart1 = 0;
byte hourStop1 = 0;
byte minuteStop1 = 0;
byte hourInterval1 = 0;
byte minuteInterval1 = 0;
//==Serial Variable for ROOM 2==
byte hourStart2 = 0;
byte minuteStart2 = 0;
byte hourStop2 = 0;
byte minuteStop2 = 0;
byte hourInterval2 = 0;
byte minuteInterval2 = 0;
//===========end===========

//==================ALARM ID==================
AlarmID_t alarmStart1, alarmStop1, alarmTimer1; //ID for interval Slave 1
AlarmID_t alarmStart2, alarmStop2, alarmTimer2; //ID for interval Slave 2
//====================end=====================
//error when I send I174117430001174217440002 --FIxed
// I174117430001174217440002
// I083008320001083108330002
// I082708300001083108330002
// I083508380001083608400002

void setup()
{
  Serial.begin(9600);
  //  setSyncProvider(RTC.get);   // the function to get the time from the RTC
  //  setSyncInterval(600);
  // setTime(8,29,40,1,1,10); // set time to 8:29:40am Jan 1 2010
  setTime(8,26,40,1,1,10);
  if(timeStatus()!= timeSet)
    Serial.println("Time isn't synced! ");
  else
    Serial.println(" time is synced!  ");
  delay(1000);
  //ROOM 1
  alarmStart1 = Alarm.alarmRepeat(8, 27, 00, Start1); //==start alarm mode interval slave 1
  alarmStop1  = Alarm.alarmRepeat(8, 29, 30, Stop1); //==stop alarm mode interval slave 1
  alarmTimer1 = Alarm.timerRepeat( 1 * SECS_PER_MIN, doRing1 );
  Alarm.disable(alarmTimer1);
  //ROOM 2
  alarmStart2 = Alarm.alarmRepeat(8, 27, 10, Start2); //==start alarm mode interval slave 2
  alarmStop2  = Alarm.alarmRepeat(8, 29, 30, Stop2); //==stop alarm mode interval slave 2
  alarmTimer2 = Alarm.timerRepeat( 2 * SECS_PER_MIN, doRing2 );
  Alarm.disable(alarmTimer2);
}

void  loop(){
  if(Serial.available())
  {
    char header = Serial.read();
    if (header == TIME_HEADER)
    {
      showAlarmTime(alarmStart1);
      showAlarmTime(alarmStop1);
      showAlarmTime(alarmTimer1);
      showAlarmTime(alarmStart2);
      showAlarmTime(alarmStop2);
      showAlarmTime(alarmTimer2);
      //processSyncMessage();
    }
    else if (header == INT_SLAVE)
      getNewAlarmTimesl();
  }
  time_t t = now();
  digitalClockDisplay(t);
  Alarm.delay(1000); // wait one second between clock display
}

void digitalClockDisplay(time_t t)
{
  // digital clock display of the time
  Serial.print(hour(t));
  printDigits(minute(t));
  printDigits(second(t));
  Serial.println();
}

void printDigits(int digits)
{
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

//========================reading UNIX TIME==========================//
void processSyncMessage()
{
  time_t pctime = 0;
  while (Serial.available() > TIME_MSG_LEN);
  for(int i=0; i < TIME_MSG_LEN -1; i++)
  {  
    char c = Serial.read();
    if( c >= '0' && c <= '9'){  
      pctime = (10 * pctime) + (c - '0') ;  
    }
  }
  time_t t = pctime;
  //  RTC.set(t);
  //setTime(t);
}

//=========CHANGE ALARM data from SERIAL MESSAGE =========//
void setAlarm( time_t alarmNumber, time_t start, time_t stop, time_t interval)
{
  if(alarmNumber == 1)
  {    
    Alarm.disable (alarmStart1);
    Alarm.disable (alarmStop1);
    Alarm.disable (alarmTimer1);
    Alarm.free (alarmStart1);
    Alarm.free (alarmStop1);
    Alarm.free (alarmTimer1);
    alarmStart1 = Alarm.alarmRepeat(start, Start1);
    alarmStop1  = Alarm.alarmRepeat(stop, Stop1);
    alarmTimer1 = Alarm.timerRepeat( interval, doRing1);
    Alarm.disable (alarmTimer1);
  }
  else if(alarmNumber == 2)
  {    
    Alarm.disable (alarmStart2);
    Alarm.disable (alarmStop2);
    Alarm.disable (alarmTimer2);
    Alarm.free (alarmStart2);
    Alarm.free (alarmStop2);
    Alarm.free (alarmTimer2);
    alarmStart2 = Alarm.alarmRepeat(start, Start2);
    alarmStop2  = Alarm.alarmRepeat(stop, Stop2);
    alarmTimer1 = Alarm.timerRepeat( interval, doRing2);
    Alarm.disable (alarmTimer2);
  }

  Serial.print("Seting alarm ");
  Serial.println(alarmNumber);
  Serial.print("Start:  ");
  digitalClockDisplay(start);
  Serial.print("Stop:  ");
  digitalClockDisplay(stop);
  Serial.print("Interval :  ");
  digitalClockDisplay(interval);

}

void getNewAlarmTimesl()
{  
  unsigned long startTime = millis();
  while(Serial.available() < 24)
  {
    if(millis() - startTime > 1000)
    {
      Serial.println("got header but timed out waiting for 24 bytes");
      return;
    }
  }    

  //===========for ROOM 1===========
  hourStart1 = getIntFromAscii(2);
  minuteStart1 = getIntFromAscii(2);
  hourStop1 = getIntFromAscii(2);
  minuteStop1 = getIntFromAscii(2);
  hourInterval1 = getIntFromAscii(2);
  minuteInterval1 = getIntFromAscii(2);

  //===========for ROOM 2===========
  hourStart2 = getIntFromAscii(2);
  minuteStart2 = getIntFromAscii(2);
  hourStop2 = getIntFromAscii(2);
  minuteStop2 = getIntFromAscii(2);
  hourInterval2 = getIntFromAscii(2);
  minuteInterval2 = getIntFromAscii(2);

  //================================================================room 1
  time_t newStart,newStop,newInterval;  


  newStart = AlarmHMS (hourStart1, minuteStart1, 0);
  newStop  = AlarmHMS (hourStop1, minuteStop1, 30);
  newInterval = AlarmHMS (hourInterval1, minuteInterval1, 0);
  setAlarm(1, newStart, newStop, newInterval);
  Serial.println (hourStart1);
  Serial.println (minuteStart1);
  Serial.println (hourStart2);
  Serial.println (minuteStart2);

  //================================================================room 2

  newStart = AlarmHMS (hourStart2, minuteStart2, 0);
  newStop  = AlarmHMS (hourStop2, minuteStop2, 30);
  newInterval = AlarmHMS (hourInterval2, minuteInterval2, 0);
  setAlarm(2, newStart, newStop, newInterval);
  Serial.println (hourStart1);
  Serial.println (minuteStart1);
  Serial.println (hourStart2);
  Serial.println (minuteStart2);
  //setup();
}

int getIntFromAscii(int nbrDigits)
{
  int val = 0;
  for(int i=0; i < nbrDigits; i++) {
    val = (val *10) + Serial.read()- '0';
  }
  return  val;
}

/*==================== ALARM ROOM 1, START and STOP =================*/
//==================================================================================
void Start1(){
  Alarm.enable(alarmTimer1);
  Serial.println("ROOM 1111111 START");
  delay(1000);
}
void Stop1(){
  Alarm.disable(alarmTimer1);
  Serial.println("ROOM 1111111 STOP");
  delay(1000);
}

void doRing1(){
  Serial.println("^^^^^^one^^^^^^");
  delay(1000);
}
/*==================== ALARM ROOM 2, START and STOP =================*/
//==================================================================================
void Start2(){
  Alarm.enable(alarmTimer2);
  Serial.println("ROOM 2222222 START");
  delay(1000);
}
void Stop2(){
  Alarm.disable(alarmTimer2);
  Serial.println("ROOM 2222222 STOP");
  delay(1000);
}

void doRing2(){
  Serial.println("2222~t w o~2222 ");
  delay(1000);
}

void showAlarmTime(AlarmID_t id)
{
  time_t alarmTime = Alarm.read(id);
  if(alarmTime!= 0)
  {
    if( alarmTime <= SECS_PER_DAY)  
      Serial.print(" repeat alarm with ID ");
    else  
      Serial.print(" once only alarm with ID  ");
    Serial.print(id, DEC);    
    Serial.print(" set for ");
    digitalClockDisplay(alarmTime);
  }  
}



Quote
plant do not take up water via rootsystem when its dark. so when the lichts are on from 12:00 tot 00:00
i wat the pump to be on for 15 minutes en then turn it off for 45 minutes. that means i have 12 cycles when lights are on.
you can use many alarm IDs to enable/disable your pin. here's the idea (use Alarm.alarmRepeat):
alarm_ID_1: 12.01 - 12.15 --> enable pin D3
alarm_ID_2: 12.16 - 13.00 --> disable pin D3
alarm_ID_3: 13.01 - 13.15 --> enable pin D3
alarm_ID_4: 13.16 - 14.00 --> disable pin D3
....
...
alarm_ID_XX: 23.01 - 23.15 --> enable pin D3
alarm_ID_XX: 23.16 - 00.00 --> disable pin D3

to make the alarm ID more that 6, mem's said
Quote
You can change the number of alarms by changing the value of dtNbr_ALARMS in TimeAlarms.h as follows:

#define dtNBR_ALARMS XX

XX=number of alarms you need


maybe other member can help to make it simpler.





6  Using Arduino / Project Guidance / Re: clock with multiple alarms on: July 26, 2014, 04:26:32 am

Quote
when i set the alarm via serial monitor, the alarms still do not go off.
when i do not edit sketch and just upload ur code above the alarms do trigger.
same problem as my post above smiley-sad
i am sorry, i left my board on my lab.
i hope i can check it soon.

Quote
also is it possible to set 1 intervals? i want to be able to set 1 to run a pin high for like 15/30 minutes.
and then another interval to get 75/90 minutes of pin low.
it is the same pin?can you explain the detail what do you want to do?

7  Using Arduino / Project Guidance / Re: clock with multiple alarms on: July 25, 2014, 01:00:17 am
You are welcome.
i dont know about arduino Yun.,
but i guess you shoud see mem's example about how to set time via NTP Server.  Network Time Protocol.
NTP server uses Unix Time Format. So, you have to understand how to convert Unix Time to hh:mm:ss format.

try this code. i guess because i disable the alarmStart1, stop1, start12, and stop2.

Code:
#include <Time.h>
#include <TimeAlarms.h>

//Serial data parsing RTC Function
#define TIME_MSG_LEN  11   
#define TIME_HEADER  'T'   
//===========end============
//Serial data parsing for ALARM
#define PJG_DATA 25
#define INT_SLAVE 'I'
//===========end============

//==Serial Variable for ROOM 1==
byte hourStart1 = 0;
byte minuteStart1 = 0;
byte hourStop1 = 0;
byte minuteStop1 = 0;
byte hourInterval1 = 0;
byte minuteInterval1 = 0;
//==Serial Variable for ROOM 2==
byte hourStart2 = 0;
byte minuteStart2 = 0;
byte hourStop2 = 0;
byte minuteStop2 = 0;
byte hourInterval2 = 0;
byte minuteInterval2 = 0;
//===========end===========

//==================ALARM ID==================
AlarmID_t alarmStart1, alarmStop1, alarmTimer1; //ID for interval Slave 1
AlarmID_t alarmStart2, alarmStop2, alarmTimer2; //ID for interval Slave 2
//====================end=====================

void setup()
{
  Serial.begin(9600);
//  setSyncProvider(RTC.get);   // the function to get the time from the RTC
//  setSyncInterval(600);
  setTime(8,29,40,1,1,10); // set time to 8:29:40am Jan 1 2010
  if(timeStatus()!= timeSet)
    Serial.println("Time isn't synced! ");
  else
    Serial.println(" time is synced!  ");
  delay(1000);
    //ROOM 1
  alarmStart1 = Alarm.alarmRepeat(20, 27, 00, Start1); //==start alarm mode interval slave 1
  alarmStop1   = Alarm.alarmRepeat(20, 29, 00, Stop1); //==stop alarm mode interval slave 1
  alarmTimer1 =  Alarm.timerRepeat( 1 * SECS_PER_MIN, doRing1 );
  Alarm.disable(alarmTimer1);
  //ROOM 2
  alarmStart2 = Alarm.alarmRepeat(20, 28, 00, Start2); //==start alarm mode interval slave 2
  alarmStop2   = Alarm.alarmRepeat(20, 30, 00, Stop2); //==stop alarm mode interval slave 2
  alarmTimer2 =  Alarm.timerRepeat( 2 * SECS_PER_MIN, doRing2 );
  Alarm.disable(alarmTimer2);
}

void  loop(){
  if(Serial.available())
  {
    char header = Serial.read();
    if (header == TIME_HEADER)
   {
   showAlarmTime(alarmStart1);
   showAlarmTime(alarmStop1);
   showAlarmTime(alarmTimer1);
   showAlarmTime(alarmStart2);
   showAlarmTime(alarmStop2);
   showAlarmTime(alarmTimer2);;//processSyncMessage();
   }
    else if (header == INT_SLAVE)
      getNewAlarmTimesl();
  }
  time_t t = now();
  digitalClockDisplay(t);
 
  Alarm.delay(1000); // wait one second between clock display
}

void digitalClockDisplay(time_t t)
{
  // digital clock display of the time
  Serial.print(hour(t));
  printDigits(minute(t));
  printDigits(second(t));
  Serial.println();
}

void printDigits(int digits)
{
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

//========================reading UNIX TIME==========================//
void processSyncMessage()
{
  time_t pctime = 0;
  while (Serial.available() > TIME_MSG_LEN);
  for(int i=0; i < TIME_MSG_LEN -1; i++)
  {   
    char c = Serial.read();
    if( c >= '0' && c <= '9'){   
      pctime = (10 * pctime) + (c - '0') ; 
    }
  }
  time_t t = pctime;
//  RTC.set(t);
  setTime(t);
}

//=========CHANGE ALARM data from SERIAL MESSAGE =========//
void setAlarm( time_t alarmNumber, time_t start, time_t kstop, time_t interval)
{
  if(alarmNumber == 1)
  {   
    Alarm.write (alarmStart1, start);
    Alarm.write (alarmStop1, kstop);
    Alarm.write (alarmTimer1, interval);
    Alarm.disable (alarmTimer1);
  }
  else if(alarmNumber == 2)
  {   
    Alarm.write (alarmStart2, start);
    Alarm.write (alarmStop2, kstop);
    Alarm.write (alarmTimer2, interval);   
    Alarm.disable (alarmTimer2);
  }

  Serial.print("Seting alarm ");
  Serial.println(alarmNumber);
  Serial.print("Start:  ");
  digitalClockDisplay(start);
  Serial.print("Stop:  ");
  digitalClockDisplay(kstop);
  Serial.print("Interval :  ");
  digitalClockDisplay(interval);

}
   


void getNewAlarmTimesl()

  unsigned long startTime = millis();
  while(Serial.available() < 24)
  {
    if(millis() - startTime > 1000)
    {
       Serial.println("got header but timed out waiting for 24 bytes");
       return;
    }
  }   

   //===========for ROOM 1===========
   hourStart1 = getIntFromAscii(2);
   minuteStart1 = getIntFromAscii(2);
   hourStop1 = getIntFromAscii(2);
   minuteStop1 = getIntFromAscii(2);
   hourInterval1 = getIntFromAscii(2);
   minuteInterval1 = getIntFromAscii(2);
   
   //===========for ROOM 2===========
   hourStart2 = getIntFromAscii(2);
   minuteStart2 = getIntFromAscii(2);
   hourStop2 = getIntFromAscii(2);
   minuteStop2 = getIntFromAscii(2);
   hourInterval2 = getIntFromAscii(2);
   minuteInterval2 = getIntFromAscii(2);
   
   //================================================================room 1
   time_t newStart,newStop,newInterval; 

   newStart = AlarmHMS (hourStart1, minuteStart1, 0);
   newStop  = AlarmHMS (hourStop1, minuteStop1, 30);
   newInterval = AlarmHMS (hourInterval1, minuteInterval1, 0);
   setAlarm(1, newStart, newStop, newInterval);
   Serial.println (newStart);
   Serial.println (newStop);
   Serial.println (newInterval);
   //================================================================room 2
   
   newStart = AlarmHMS (hourStart2, minuteStart2, 0);
   newStop  = AlarmHMS (hourStop2, minuteStop2, 30);
   newInterval = AlarmHMS (hourInterval2, minuteInterval2, 0);
   setAlarm(2, newStart, newStop, newInterval);
   Serial.println (newStart);
   Serial.println (newStop);
   Serial.println (newInterval);
}

int getIntFromAscii(int nbrDigits)
{
  int val = 0;
  for(int i=0; i < nbrDigits; i++) {
    val = (val *10) + Serial.read()- '0';
  }
  return  val;
}

/*==================== ALARM ROOM 1, START and STOP =================*/
//==================================================================================
void Start1(){
  digitalWrite(13, HIGH);
  Serial.println("Licht = Aan");
  delay(1000);
}
void Stop1(){
  digitalWrite(13, LOW);
  Serial.println("Licht = Uit");
  delay(1000);
}

void doRing1(){
  Serial.println("interval = 1");
  delay(1000);
}
/*==================== ALARM ROOM 2, START and STOP =================*/
//==================================================================================
void Start2(){
  Alarm.enable(alarmTimer2);
  Serial.println("Pomp = Aan");
  delay(1000);
}
void Stop2(){
  Alarm.disable(alarmTimer2);
  Serial.println("Pomp = Uit");
  delay(1000);
}

void doRing2(){
  Serial.print("Interval = 2");
  delay(1000);
}

void showAlarmTime(AlarmID_t id)
{
  time_t alarmTime = Alarm.read(id);
  if(alarmTime!= 0)
  {
    if( alarmTime <= SECS_PER_DAY) 
       Serial.print(" repeat alarm with ID ");
    else 
        Serial.print(" once only alarm with ID  ");
    Serial.print(id, DEC);   
    Serial.print(" set for ");
    digitalClockDisplay(alarmTime);
  }
}

}
8  Using Arduino / Project Guidance / Re: clock with multiple alarms on: July 23, 2014, 12:01:55 pm
you need to change the int to time_t in SetAlarm routine and disable each alarm ID
hope this help
Code:
void setAlarm( time_t alarmNumber, time_t yukstart, time_t yukstop, time_t yukinterval)
{
  if(alarmNumber == 1)
  {    
    Alarm.write (alarmStart1, yukstart);
    Alarm.disable (alarmStart1);
    Alarm.write (alarmStop1, yukstop);
    Alarm.disable (alarmStop1);
    Alarm.write (alarmTimer1, yukinterval);
    Alarm.disable (alarmTimer1);
  }
  else if(alarmNumber == 2)
  {    
    Alarm.write (alarmStart2, yukstart);
    Alarm.disable (alarmStart2);
    Alarm.write (alarmStop2, yukstop);
    Alarm.disable (alarmStop2);
    Alarm.write (alarmTimer2, yukinterval);    
    Alarm.disable (alarmTimer2);
  }

  Serial.print("Seting alarm ");
  Serial.println(alarmNumber);
  Serial.print("Start:  ");
  digitalClockDisplay(yukstart);
  Serial.print("Stop:  ");
  digitalClockDisplay(yukstop);
  Serial.print("Interval :  ");
  digitalClockDisplay(yukinterval);

}
9  Using Arduino / Project Guidance / Re: clock with multiple alarms on: July 23, 2014, 07:03:26 am
i am sorry for the delayed response.. i will try to check my code again and hope i can solve the problem..

that code is wrong for some reason.
1. if you send a serial data, it will trigger the alarm for rooom 1 and room 2.
2. new alarm activation is failed. the serial handling routine is work just fine, but when it is failed to set the new alarm time.

i think, the problem is how to enable and disable the alarms, and how to set the new alarm time.
10  Using Arduino / Project Guidance / Re: clock with multiple alarms on: July 21, 2014, 11:02:28 pm
I am so sorry, actually I can't exactlly remember how i solved it.

i think i just added
only this line of code:
Code:
...
setup()
...

but, i forget where i placed the code, just try it. sorry..  smiley-roll-sweat

i hope i wiil figure it out soon
11  Using Arduino / Networking, Protocols, and Devices / Re: UNO + Sparkfun's Xbee Shield Always Reset if Receiving Data From X-CTU Terminal on: September 15, 2013, 08:35:29 am
this code works like a charm:

Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);

void setup()
{
    Serial.begin(9600);
    Serial.println("XBee Example!");

    // set the data rate for the SoftwareSerial port
    mySerial.begin(9600);

}

void loop() // run over and over
{
    if (mySerial.available())
        Serial.write(mySerial.read());
    if (Serial.available())
        mySerial.write(Serial.read());
}

i got it from here:
garagelab.com/profiles/blogs/tutorial-xbee-with-arduino

Once again, thanks, PaulS, for the "SoftwareSerial" clue.

12  Using Arduino / Networking, Protocols, and Devices / Re: UNO + Sparkfun's Xbee Shield Always Reset if Receiving Data From X-CTU Terminal on: September 15, 2013, 12:58:48 am
Quote
PROBLEM:
when I write something on X-CTU Terminal Tab, and Serial Monitor on Arduino IDE cannot read what i write in X-CTU, and after a while the arduino board reset itself. when I write '1' in X-CTU terminal, the Arduino Board reset automatically.

Have you done any testing just using the serial monitor to communicate with the arduino? Note that a communication application connected to an arduino that opens a com port, sends data, then closes may cause the arduino to reset.

Yes, using serial monitor, the arduino works just fine. 
13  Using Arduino / Networking, Protocols, and Devices / Re: UNO + Sparkfun's Xbee Shield Always Reset if Receiving Data From X-CTU Terminal on: September 15, 2013, 12:54:58 am
Quote
But, you need to. You need to tell each one it's name (MY) and who to talk to (DL). Obviously, DH on one is MY on the other.

Oh, alright then. I will do some digging and report the result here.
But, according to youtube xbee tutorial (mentioned on my 1st post), i dont need to change xbee setting, and that works just fine.  smiley-confuse smiley-confuse
thanks, PaulS.

Quote
There is only one kind of SoftwareSerial.
in this link: http://arduino.cc/en/Reference/SoftwareSerial, isnt it?
14  Using Arduino / Networking, Protocols, and Devices / Re: UNO + Sparkfun's Xbee Shield Always Reset if Receiving Data From X-CTU Terminal on: September 14, 2013, 12:38:22 pm
Thanks, PaulS for the fast response.

Quote
It would be a lot simpler to debug the issue if you put the switch in the other position, and used SoftwareSerial to talk to the XBee and Serial to talk to the PC. Using one port to talk to two devices IS going to frustrate you no end.

i have no idea how to debug this thing, and if i put the switch in DLINE position then i got nothing in my Arduino Serial Monitor.

what kind of SoftwareSerial should i use?it it a software/sketch or?


Quote
Of course, it would also help if you mentioned something about how the XBees are configured. Digi claims that they need no configuration, but that is a load of horsecrap.

i dont changed anything in modem config. and those 2 Xbees have the same PAN ID: 3332

15  Using Arduino / Networking, Protocols, and Devices / UNO + Sparkfun's Xbee Shield Always Reset if Receiving Data From X-CTU Terminal on: September 14, 2013, 03:31:24 am
Hello World.
I'm new to xbee stuff and i have a problem to communicating xbee using this modules:
- 1 x Arduino Uno R3
- 1 x Sparkfun's Xbee Shield: https://www.sparkfun.com/products/10854
- 1 x DFRobot Xbee USB Adapter V2: http://www.dfrobot.com/index.php?route=product/product&product_id=588
- 2 x Xbee 60mW Wire Antenna S1

Arduino IDE: 1.0.5

this is the block diagram that i used:

and i am following this tutorial http://youtu.be/WTnC1bHoaDM

code:
Code:
int myData = 0;
int const ledpin = 13;

void setup(){
 Serial.begin(9600);
 pinMode(ledpin, OUTPUT);
}

void loop(){
  if (Serial.available() > 0){
    myData = Serial.read();
    
    if (myData == '1'){
      digitalWrite(ledpin, HIGH);
      Serial.write(myData);
    }
    
    if (myData == '2'){
      digitalWrite(ledpin, LOW);
      Serial.write(myData);
    }
    
    else {
      Serial.write(myData);
    }
    delay (10);
  }
}

PROBLEM:
when I write something on X-CTU Terminal Tab, and Serial Monitor on Arduino IDE cannot read what i write in X-CTU, and after a while the arduino board reset itself. when I write '1' in X-CTU terminal, the Arduino Board reset automatically.

note: Xbee Shield SPDT Switch position = UART.

But,
when i disconnected the arduino with the PC, and connected it to external power, the LED on pin 13 went ON/OFF if I write 1/2 on X-CTU terminal.

Sorry for my english.

Any help appreciated. Thanks.
Pages: [1] 2 3 4