To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 19361
19360  |  19362
Subject: 
Re: IC 4.01 - RCX advanced library
Newsgroups: 
lugnet.robotics
Date: 
Tue, 29 Oct 2002 03:39:07 GMT
Original-From: 
Scott Davis <rcx2man@hotmail.com/spamcake/>
Viewed: 
792 times
  
I just found this in the sample programs that came with IC 4.01.
Will this work?

Scott



/* COMMUNICATION */
void IRLong(){               /* Long range IR*/
    callml(0,0x11);
}
void IRShort(){                 /* short range IR */
    callml(0,0x12);
}
void disableirpackets(){     /* disables interpretation of packets.  This is
necessary to be able to recieve serial characters in a program */
    callml(1,0x16);
}
void enableirpackets(){      /* reenables packet reception/transmission */
    callml(0,0x16);
}
int ready(){                   /* 1 for character is ready, 0 for no
character */
    return callml(0,0x17);
}
int irget(){                 /* returns a character from the recieve buffer,
or -1 if there is no character*/
    if (ready())  return callml(0,0x18);
    else return -1;
}
void irsend(int c){             /* send serial character */
    callml( c, 0x19);
}
/* buttons */
void buttoncommandsoff(){   /* required for using on/off and run buttons in
a program. Also useful to keep a robot from accidently turning itself off
during a game */
    callml(1,0x13);
}
void buttoncommandson(){    /* reenables buttons */
    callml(0,0x13);
}
int run(){
    if ( callml(0,0x0a) & 1 ) return 1; else return 0;
}
int onoff(){
    if ( callml(0,0x0a) & 8 ) return 1; else return 0;
}





----- Original Message -----
From: "Scott Davis" <rcx2man@hotmail.com>
To: <lego-robotics@crynwr.com>; "Ralf Krause" <rkra@gmx.de>
Sent: Monday, October 28, 2002 10:26 PM
Subject: Re: IC 4.01 - RCX advanced library


Where do I put the advanced library?
What I'm looking for is using the ir for proximity detection.

Scott
----- Original Message -----
From: "Ralf Krause" <rkra@gmx.de>
To: "Scott Davis" <rcx2man@hotmail.com>
Sent: Monday, October 28, 2002 10:19 AM
Subject: Re: IC 4.01 - RCX advanced library


Hi Scott,

if you want to communicate with two rcx the following
could help. I could not test the functions yet but it
seems be what you asked for.

Perhaps you could answer if you tried it ...
Ralf


------------- snip ------------------------------

//===============================================
//
// rxcextra.ic
//
// RCX advanced library
// for interactive C 4.01
//
//===============================================


// COMMUNICATION

//-----------------------------------------------
// ir_long()
// set long range IR transmission
//-----------------------------------------------
void ir_long(){
  callml(0,0x11);
}


//-----------------------------------------------
// ir_short()
// set short range IR transmission
//-----------------------------------------------
void ir_short() {
  callml(0,0x12);
}


//-----------------------------------------------
// ir_disablepackets()
// This is necessary to be able to recieve
// serial characters in a program
//-----------------------------------------------
void ir_disablepackets() {
  callml(1,0x16);
}


//-----------------------------------------------
// ir_enablepackets()
// reenables packet the reception/transmission
//-----------------------------------------------
void ir_enablepackets() {
  callml(0,0x16);
}


//-----------------------------------------------
// ir_ready()
// returns 1 for character is ready, or
// returns 0 for no character */
//-----------------------------------------------
int ir_ready() {
  return callml(0,0x17);
}


//-----------------------------------------------
// ir_get()
// returns a character from recieve buffer, or
// returns -1 if there is no character
//-----------------------------------------------
int ir_get() {
  if (ir_ready())  return callml(0,0x18);
  else return -1;
}


//-----------------------------------------------
// ir_send(c)
// send a serial character c
//-----------------------------------------------
void ir_send(int c) {
  callml(c,0x19);
}



// BUTTONS

//-----------------------------------------------
// required for using on/off and run buttons
// in a program. Also useful to keep a robot
// from accidently turning itself off during
// a game
//-----------------------------------------------
void buttoncommandsoff() {
  callml(1,0x13);
}

void buttoncommandson() {
  callml(0,0x13);
}


//-----------------------------------------------
// control the run button
//-----------------------------------------------
int run() {
  if ( callml(0,0x0a) & 1 ) return 1;
  else return 0;
}


//-----------------------------------------------
// control the on/off button
//-----------------------------------------------
int onoff() {
  if ( callml(0,0x0a) & 8 ) return 1;
  else return 0;
}

------------- snip ------------------------------




Am 2002-10-28 2:09 Uhr schrieb "Scott Davis" unter • <rcx2man@hotmail.com>:

How do you send IR with IC?  Can it even be done?

thanks
Scott







Message has 1 Reply:
  Re: IC 4.01 - RCX advanced library
 
Hi Scott, it's the same. I reformatted it to get it better readable. I wanted to understand what the author did in his programming. Ralf Am 2002-10-29 4:39 Uhr schrieb "Scott Davis" unter <rcx2man@hotmail.com>: (...) (22 years ago, 29-Oct-02, to lugnet.robotics)

2 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