View unanswered posts | View active topics It is currently Sat Sep 20, 2014 10:05 am






Reply to topic  [ 6 posts ] 
Communication Bluetooth 
Author Message
Rookie

Joined: Tue May 05, 2009 5:06 pm
Posts: 2
Post Communication Bluetooth
Hi! Please somebody help me!
Sorry for my bad english, i'm italian..
After i have connected 2 nxt via bluetooth manually, i don't understand how to send/receive a message.
I would that once the NXT (1) sends the command "go" the other NTX (2) were starting my program.
I see the example program but i don't understand it.
I use Robot C 1.46
Somebody can help me??
Thanks


Tue May 05, 2009 5:19 pm
Profile
Rookie

Joined: Thu Jun 26, 2008 10:42 am
Posts: 12
Post Re: Communication Bluetooth
Hmm... you can see here how to automatically connect NXTs (in your program). And here code for your task:
For first NXT:
Code:
task main {
  // Your initializations here

  int port = 1; // To which port second NXT connected
  byte message[] = { 123 };
  for (int i = 0; i < 10; i++) // Sending message for 10 times, because sometimes the message does not reach
    cCmdMessageWriteToBluetooth(port, message, sizeof message, mailbox1);

  // Your code here
}


And for second NXT:
Code:
task main {
  // Your initializations here

  while (cCmdMessageGetSize(mailbox1) < 1) wait1Msec(1); // Waiting for incoming message

  // Your code here
}


Good luck!

P.S. initializations is sensor's calibrations and other commands that must be executed once at the beginning of the program


Wed May 06, 2009 4:33 am
Profile
Rookie

Joined: Tue May 05, 2009 5:06 pm
Posts: 2
Post Re: Communication Bluetooth
Thank you very much!
I have another question...
This string:
Quote:
cCmdMessageWriteToBluetooth(port, message, sizeof message, mailbox1);

I personalize it?


Wed May 06, 2009 3:11 pm
Profile
Rookie

Joined: Tue Jul 12, 2011 10:24 am
Posts: 20
Post Re: Communication Bluetooth
okay somebody can gives a example how to realize this:

Master -> Send some command
Slave -> Moves motorA
Slave -> wait for next command
....


Mon Jul 18, 2011 8:57 am
Profile
Rookie

Joined: Tue Jul 12, 2011 10:24 am
Posts: 20
Post Re: Communication Bluetooth
please tell me how can I read the bluetooth messages and how can I tell the robot to do some movements...?!


Fri Jul 22, 2011 9:38 am
Profile
Rookie

Joined: Sun Oct 30, 2011 12:54 pm
Posts: 7
Post Re: Communication Bluetooth
Send a message :
Task Main()
{
string message;
char Temp;
while(strlen(message))
{
Temp = StringGetChar(message,0);
nxtWriteRawHS(Temp, 1);
StringDelete(message, 0, 1);
}
wait1Msec(5);
}


Thu Dec 22, 2011 5:37 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.