Subject:
|
Re: IC 4.01 - RCX advanced library
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Mon, 28 Oct 2002 16:42:52 GMT
|
Original-From:
|
Ralf Krause <RKRA@GMXantispam.DE>
|
Viewed:
|
940 times
|
| |
| |
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 is in Reply To:
| | IC 4.01
|
| How do you send IR with IC? Can it even be done? thanks Scott (22 years ago, 28-Oct-02, to lugnet.robotics)
|
7 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|