|
Page 1 of 1
|
[ 15 posts ] |
|
Simple Bluetooth Test Program won't Complile
Author |
Message |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Simple Bluetooth Test Program won't Complile
Hey, I'm trying to learn how to use the NXT's Bluetooth functions because I recently got another NXT and want to see if I can get them to work together. Pairing them up I can do, but now I'm trying to write a test program to send a message from one NXT to the other, and it won't compile. Here's the code: I also found an example program online here ( http://carrot.whitman.edu/Robots/notes.pdf), and that won't compile either: For both, I get an error saying this: Does anyone know what I'm doing wrong? Am I forgetting to include something at the start of my program or something? thanks,
_________________leonoverweel.com
|
Fri Dec 16, 2011 7:03 pm |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: Simple Bluetooth Test Program won't Complile
If your using the any version higher than 2.26, then you don't have those commands anymore. They removed them when they stopped RCX support. I believe the most basic way to send a message now is:
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
Last edited by NeXT-Generation on Fri Dec 16, 2011 8:31 pm, edited 1 time in total.
|
Fri Dec 16, 2011 7:27 pm |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: Simple Bluetooth Test Program won't Complile
Thanks! The PDF I was using is pretty old, so that's probably it. One more thing: what would i put in the "nQueueID" spot? Is it the line the other NXT is connected to?
thanks again
_________________leonoverweel.com
|
Fri Dec 16, 2011 8:03 pm |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: Simple Bluetooth Test Program won't Complile
"nQueueID" refers to the mailbox number. Another thing: If your ever using more than two bricks, then put the number of the one that your messaging to before the other parameters.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
Fri Dec 16, 2011 8:46 pm |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: Simple Bluetooth Test Program won't Complile
Okay thanks. Is there anything else I need to call before this? And where do I find the other NXT's mailbox number (is it the NXT's name)? Also, how do I change what the NXT sends? I'm trying to get one of the NXTs to send a number between 1 and 10 to the other one, and the other one should receive it and use it in a switch loop.
thx
_________________leonoverweel.com
|
Fri Dec 16, 2011 8:51 pm |
|
 |
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 630 Location: If I told you, I'd have to kill you.
|
 Re: Simple Bluetooth Test Program won't Complile
To select the mailbox, simply type "mailboxi(where 'i' is the number (1-10) of the mailbox)".
Unfortunately, that's as far as my knowledge goes. What I've told you so far is what I've gathered from the help files and sample programs. I haven't put it into practice.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
Fri Dec 16, 2011 9:27 pm |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: Simple Bluetooth Test Program won't Complile
Okay. I've been doing some more research myself and I just found these two programs that seem to do the job for me. I'll post them here in case anyone who needs something like this finds this thread. Master program: slave program: To change what the master sends to the slave, you change "count[0] = 10" to "count[0] = YourNumber". Thanks a lot for the help anyways 
_________________leonoverweel.com
|
Fri Dec 16, 2011 9:32 pm |
|
 |
Dad and Adam
Novice
Joined: Thu Apr 17, 2008 6:04 am Posts: 70 Location: Plymouth, Indiana, USA
|
 Re: Simple Bluetooth Test Program won't Complile
The current help file (ROBOTC for LEGO® MINDSTORMS™ 3.xx - Users Manual) still lists sendMassage and sendMassageWithParms as being viable commands. -Bluetooth and the NXT ----Simple BlueTooth Messaging I hope this will be updated soon. The User's Manual is vital for a novice like myself. Dave
_________________ Dad (Dave) and Adam
|
Sun Dec 18, 2011 7:52 am |
|
 |
Dad and Adam
Novice
Joined: Thu Apr 17, 2008 6:04 am Posts: 70 Location: Plymouth, Indiana, USA
|
 Re: Simple Bluetooth Test Program won't Complile
I've been trying to figure out bluetooth for my two NXTs. Using RobotC 2.02 I made good progress using the commands "sendMassage" and "sendMassageWithParms" and so on. Within a short time I had a little remote control vehicle going across my blacklisted_site. Life was good. Then, I upgraded RobotC to 3.04 and "sendMassage" and "sendMassageWithParms" no longer worked. I've turned to the forum to try get help with the commands available in 3.04 I am confused by the line: cCmdMessageWriteToBlueTooth(pData, nLength, nQueueID) My interpetation is: pData is the varible to send. so it can be a number, variable or string. nLengh is the length of the information in pData (so for a ubyte it's 8, int 16). nQueueID is....? The sample below was earlier in this thread. For me (in 3.04) it produced an error for cCmdMessageWriteToBluetooth(count,1,1); How could the middle augument be 1 if it's the length of pData? The error is:*Warning*:Invalid '=' operation for types 'TMailboxIDs' and 'short' If I change (count,1,1) to (count,1), no error is produced. But is (count,1) valid? What does the 1 mean? My interpetations are no doubt faulty. Could someone enlighten me? Whatever tweak is needed to get the above sample to compile without errors should be sufficient. Or an explanation of why (count,1) did not produce an error. Thanks, Dave
_________________ Dad (Dave) and Adam
|
Sun Dec 18, 2011 3:35 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Simple Bluetooth Test Program won't Complile
Oh man, you got the version with the free Massage? I must not have the right license activated on mine! I think the Message stuff is coming back in 3.05, for which a beta is due out RSN. - Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Sun Dec 18, 2011 4:01 pm |
|
 |
Dad and Adam
Novice
Joined: Thu Apr 17, 2008 6:04 am Posts: 70 Location: Plymouth, Indiana, USA
|
 Re: Simple Bluetooth Test Program won't Complile
The massage wasn't free, but was worth every penny! Good catch on my spelling error. I've played around abit and got something that seems to work. The sending program The receiving program I am still confused about these two lines: ----cCmdMessageWriteToBluetooth(count,1); ----cCmdMessageRead(count2,3); Confusing points: The function library calls for three auguments. Three auguments produces a warning but it still seems to run ok. ------The middle augument for write must be at least 1. ------The middle augment for read must be at least 4. ------The last auguments need to match. For only using two auguments: ----The last augument can be anything greater than zero. ----The last auguments don't have to match. ----The last auguments can be large numbers like 12342. My questions: ---What does the last augument do? ---Why does including a third augument produce a warning? ---With three auguments, what does the middle one do? The two programs only have one line each for handling the bluetooth. This seems way too simple compared to the bluetooth sample programs. As a minimum is anything else needed (besides getting confirmation of sent messages)? Side note: To me, many of the example programs are way too involved. They no doubt contain valuable information, but are overwheming for someone that just needs to get started. If the above two programs don't have serious flaws, it may be beneficial to include them (or something similar) with the bluetooth samples. Thanks, Dave
_________________ Dad (Dave) and Adam
|
Sun Dec 18, 2011 5:18 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Simple Bluetooth Test Program won't Complile
Can you send a mail to support@robotc.net about this? Also mention the issue with the sample programs being over-complicated. This has been a complaint of mine for a long, long time. There are no simple samples that do just the one thing, it's like they try to cram every bit of functionality in the one example so they only need to do that single one. - Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Sun Dec 18, 2011 5:26 pm |
|
 |
Dad and Adam
Novice
Joined: Thu Apr 17, 2008 6:04 am Posts: 70 Location: Plymouth, Indiana, USA
|
 Re: Simple Bluetooth Test Program won't Complile
I will send them something. I did some more playing around. Things started to make more sense when I turned my varible into an array. Once it became an array, It needed three auguments in the "cCmdMessage...." statements. The middle augument is the number of elements in the array! So simple when you know it. So difficult when you don't. Perhaps the red herring was that anything worked at all when the varible was not an array. The only puzzle now is why a line like: ---cCmdMessageWriteToBluetooth(count,9,3); Produces: ----*Warning*:Invalid '=' operation for types 'TMailboxIDs' and 'short' any ideas? I learned a lot today. My brain is full. Dave
_________________ Dad (Dave) and Adam
|
Sun Dec 18, 2011 6:11 pm |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: Simple Bluetooth Test Program won't Complile
Yeah I get that too, but it doesn't interfere with my program so I ignored it. But I was wondering about it too.
_________________leonoverweel.com
|
Sun Dec 18, 2011 7:54 pm |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: Simple Bluetooth Test Program won't Complile
Replace the last argument of cCmdMessageWriteToBluetooth() with one of these:  |  |  |  | Code: mailbox1 = 0, mailbox2 = 1, mailbox3 = 2, mailbox4 = 3, mailbox5 = 4, mailbox6 = 5, mailbox7 = 6, mailbox8 = 7, mailbox9 = 8, mailbox10 = 9,
|  |  |  |  |
They're an enum called TMailboxIDs and signify the mailbox number. Make sure you use matching numbers on both sides  - Xander
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Mon Dec 19, 2011 2:19 am |
|
|
|
Page 1 of 1
|
[ 15 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
|
|