To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.spyboticsOpen lugnet.robotics.spybotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Spybotics / 386
385  |  387
Subject: 
Sending Commands to Spybot from RCX - Question from a Beginner to Comm area.
Newsgroups: 
lugnet.robotics.spybotics
Date: 
Fri, 28 Jan 2005 14:39:27 GMT
Viewed: 
7913 times
  
Hi All,

I am planning to send some commands to spybot via RCX 2.0 unit. My Whole plan is
control “spybot”  using RCX unit.

To have a basic understanding of the communication, I used the sample posted my
Mark Riley 19 Aug 2002.

In RCX I used
            SetSerialData(0,0x92);
            SetSerialData(1,0x23);
            SendSerial(0,2);


            SetSerialData(0,0x92);
            SetSerialData(1,0xab);
            SendSerial(0,2);

         When it opens and closes the door of my Security Valut.

Then in spybot I used following code.

      event MessageEvent when message
      watcher MessageHandler monitor MessageEvent
            {
            select message[ iRxIR, iHiByte ] * 256 + message[ iRxIR, iLoByte ]
                        {

                        // RCX sent 0x9223 (controller red button)
                        when 0x0200 { sound sndShocked Disp(ledSparkle) }
                        // RCX sent 0x92ab
                        when 0x0103 { sound sndHitByLaser Disp(ledAlarm) }
                         }
                 }



It works perfectly. I do see the animations as I expected.

Now I have couple of questions for you all.

1.    When I send 0x9223 from RCX unit why spybot checking for 0x0200? (This may
be very primitive question. But I don’t know). Actually I want to know the
relationship of sending data and receiving data and a complete understanding of
“How RCX Communications Work?”. An URL will be alright.
2.    Then I tried to use “SetSpybotMessage” and “SendSpybotMsg” posted by John
Hanson couple of days ago. I am pretty sure message will get delivered to
spybot, but it doesn’t do any thing. Code that I used in RCX is as follows.

    SetSpybotMessage(MSG_BROADCAST, ID_BOT_MIN+1, 0, CMD_FIRE_LASER, 1, 100);
    repeat(2)
       {
        SendSpybotMsg();
        Wait(100);
       }


I didn’t change my spybot code to capture any additional messages. Do I have to
check for any value at the spybot code or not? If I have to, how can I derive it
using SetSpybotMessage parameters?  Here are the values for each constant.

MSG_BROADCAST = Ox8a, ID_BOT_MIN+1 = 9, CMD_FIRE_LASER = 0x21

I may have to change my code (using NQC) as follows.

if (RxMessage(MSG_IR, MSG_COMMAND) == COMMAND_CONTROLLER)
{
  x = RxMessage(MSG_IR, MSG_HI_BYTE);
}

But I am not quite sure about the constatnts (like COMMAND_CONTROLLER) that I
sould be checking.


Thanks in Advance,



Alex Jayasundara



Message has 1 Reply:
  Re: Sending Commands to Spybot from RCX - Question from a Beginner to Comm area.
 
(...) First of all, my apologies for not answering you via email. I've been a bit busy at work. I needed to run some tests myself before I could properly respond as well. The 0x9223 from the RCX happens to match the IR sent out by the Spybot (...) (19 years ago, 28-Jan-05, to lugnet.robotics.spybotics, lugnet.robotics, lugnet.robotics.rcx, lugnet.robotics.rcx.nqc)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR