Subject:
|
Re: Troubleshooting RCX Problems
|
Newsgroups:
|
lugnet.robotics.rcx
|
Date:
|
Sun, 6 Aug 2000 19:56:09 GMT
|
Viewed:
|
1727 times
|
| |
| |
On Sun, 6 Aug 2000 14:11:46 GMT, "Tim Courtney" <tim@zacktron.com>
wrote:
The Japanese comes out all garbled. Could you please translate to
enlish?
> "Mario Ferrari" <mario.ferrari@edis.it> wrote in message
> news:FyvIAK.8or@lugnet.com...
> > Hi Tim,
> > would you post here your code so we can have a look at it?
> >
> > Mario
>
> Here you go:
> --
>
> Tim Courtney - tim@zacktron.com
>
> http://www.ldraw.org - Centralized LDraw Resources
> http://www.zacktron.com - Zacktron Alliance
>
> ICQ: 23951114
> AIM: TimCourtne
> --
>
> //--------------------------------------------------------------------------
> --
> // MIBO Rg[vO MIBO-R01.nqc
> // ãë«S
> // NQC Ver2.2 ÅRpC·é±Æ
> //
> // Create by Jin Sato http://www.mi-ra-i.com/JinSato/
> //
> // M = MindStorms
> // I = Integrade
> // B = Bionic
> // O = Object
> //
> //--------------------------------------------------------------------------
> --
> // 1999/06/23 | ãë«ð³ÉO«ÌvOðìéB
> // 1999/08/12 | ¨ÀèÌvO
> // 2000/02/12 | öJpÉC³
> //
> //--------------------------------------------------------------------------
> --
>
>
>
> //--------------------------------------------------------------------------
> --
> // O[oÏè`B (RCXÅÍO[oϵ©g¦È¢j
>
> int fgWalk;
> int fgTail;
> int fgSit;
>
>
> //--------------------------------------------------------------------------
> --
> // ãë«ÌæñÖßðúÌÊuÉß·
> //
> void SetBeginPotition()
> {
> int nTemp;
> fgWalk = 3;
>
> SetPower( OUT_A + OUT_B + OUT_C, 7 );
>
>
> while ( fgWalk != 0 ) {
> nTemp = SENSOR_3;
> if ( nTemp <= 1 && nTemp >= -1 ) { // µ
> ÍÍðL°Ä¨©È¢Æ~ÜçÈ¢êª é
> fgWalk &= ~0x02;
> Off( OUT_C );
> } else {
> if ( nTemp > 0 ) {
> OnFwd( OUT_C );
> } else {
> OnRev( OUT_C );
> }
> }
> nTemp = SENSOR_1;
> if ( nTemp <= 1 && nTemp >= -1 ) {
> fgWalk &= ~0x01;
> Off( OUT_A );
> } else {
> if ( nTemp > 0 ) {
> OnRev( OUT_A );
> } else {
> OnFwd( OUT_A );
> }
> }
> }
> }
>
> //--------------------------------------------------------------------------
> --
> // à¢Ä¢éÌð~ßéB
> //
> void StopWalk()
> {
> if ( fgWalk != 0 ) {
> stop HizaMonitor;
> stop Walk;
> stop Tail;
>
> Off( OUT_B );
> SetBeginPotition();
> }
> }
>
>
> //--------------------------------------------------------------------------
> --
> // G̪ªKèÈãÉñ]µ½êAXgbv·éB
> //
> #define KICK_ANGLE 200
>
> task HizaMonitor()
> {
> while ( true ) {
> if ( SENSOR_3 > KICK_ANGLE ) {
> Off( OUT_C );
> }
> if ( SENSOR_3 < -KICK_ANGLE ) {
> Off( OUT_C );
> }
>
> if ( SENSOR_1 < -KICK_ANGLE ) {
> Off( OUT_A );
> }
> if ( SENSOR_1 > KICK_ANGLE ) {
> Off( OUT_A );
> }
> }
> }
>
> //--------------------------------------------------------------------------
> --
> // ð³ÉKöðUé
> //
> task Tail()
> {
> while ( true ) {
> fgTail = Random( 3 );
>
> if ( fgTail == 1 ) {
> wanwan();
> SetPower( OUT_B, 1 );
> OnFwd( OUT_B );
> Wait( 14 );
> OnRev( OUT_B );
> Wait( 14 );
> }
> Off( OUT_B );
>
> fgTail = Random( 100 ); // + 30;
>
> Wait( fgTail );
> }
> }
>
> //--------------------------------------------------------------------------
> --
> // ¶EÌãë«ÌæñÖßiGjðOãÉ®©µ·B
> //
> //
> task Walk()
> {
> SetPower( OUT_A + OUT_B + OUT_C, 7 );
>
> if ( fgWalk == 0 ) { // ܾà¢Ä¢È¢ÉÍàB
> //
> // O[oÌtOðOnɵĨ
> fgWalk = 1;
>
>
> // EÌãë«©ç¯ènßéAMIBOÌ«««ÍE¾(^^)
> do {
> OnRev( OUT_C );
> } while ( SENSOR_3 < KICK_ANGLE );
>
> while ( true ) {
>
> if ( fgWalk < 7 ) {
> //E«ð³ÌÊuÉß·
> if ( SENSOR_3 > 0 ) {
> OnFwd( OUT_C );
> } else {
> Off( OUT_C );
> fgWalk |= 0x02; // ßÊuÉßÁ½ç tOðZbg
> }
>
> // ¶«ð¯èo·B
> if ( SENSOR_1 > -KICK_ANGLE ) {
> OnRev( OUT_A );
> } else {
> Off( OUT_A ); // ®SɯèªIíÁ½ç tOðZbg
> fgWalk |= 0x04;
> }
> }
>
> //
> if ( fgWalk == 7 ) {
> if ( SENSOR_3 < KICK_ANGLE ) {
> OnRev( OUT_C );
> } else {
> Off( OUT_C );
> fgWalk &= ~0x02;
> }
>
> if ( SENSOR_1 < 0 ) {
> OnFwd( OUT_A );
> } else {
> Off( OUT_A );
> fgWalk &= ~0x04;
> }
> }
> }
> }
> }
>
>
> //--------------------------------------------------------------------------
> --
> // ¨Àè
> //
> //
>
> #define SIT_ANGLE_1 100 // «Ìt¯ªÌȪépxðwè
> #define SIT_ANGLE_2 350
>
> sub Sit()
> {
> if ( fgSit == 0 ) {
> SetPower( OUT_A + OUT_B + OUT_C, 7 );
>
> // ßɵȰé
> do {
> OnRev( OUT_B );
> } while ( SENSOR_2 < SIT_ANGLE_1 );
>
> // »ÌãAGàȰȪçÀÁÄ¢
> do {
> OnRev( OUT_B );
> if ( SENSOR_1 > -390 ) {
> OnRev( OUT_A );
> } else {
> Off( OUT_A );
> }
> if ( SENSOR_3 < 390 ) {
> OnRev( OUT_C );
> } else {
> Off( OUT_C );
> }
> } while ( SENSOR_2 < SIT_ANGLE_2 );
> Off( OUT_B );
> }
> fgSit = 1;
> }
>
> //--------------------------------------------------------------------------
> --
> //
> sub Up()
> {
> if ( fgSit != 0 ) { // àµàÀÁÄ¢êÎ
>
> SetPower( OUT_A + OUT_B + OUT_C, 7 );
>
> do {
> OnFwd( OUT_B );
> } while ( SENSOR_2 > 200 );
>
> do {
> OnFwd( OUT_B );
>
> if ( SENSOR_1 < 0 ) {
> OnFwd( OUT_A );
> } else {
> Off( OUT_A );
> }
> if ( SENSOR_3 > 0 ) {
> OnFwd( OUT_C );
> } else {
> Off( OUT_C );
> }
>
> } while ( SENSOR_2 > 0 );
> Off( OUT_B );
> }
> fgSit = 0;
>
> }
> //--------------------------------------------------------------------------
> --
> // ÆÙ¦é
> void wanwan()
> {
> PlayTone( 1462,1 ); PlayTone( 2462,1 );
> PlayTone( 1462,1 ); PlayTone( 2462,1 );
> }
>
> //--------------------------------------------------------------------------
> --
> //
> task main()
> {
>
> // ¹ðo·
> wanwan();
>
>
> // E«ÌAOZT[
> SetSensorType( SENSOR_1, SENSOR_TYPE_ROTATION );
> SetSensorMode( SENSOR_1, SENSOR_MODE_ROTATION );
> ClearSensor( SENSOR_1 );
>
> // ¶«ÌAOZT[
> SetSensorType( SENSOR_3, SENSOR_TYPE_ROTATION );
> SetSensorMode( SENSOR_3, SENSOR_MODE_ROTATION );
> ClearSensor( SENSOR_3 );
>
> // æêÖßÌAOZT[
> SetSensorType( SENSOR_2, SENSOR_TYPE_ROTATION );
> SetSensorMode( SENSOR_2, SENSOR_MODE_ROTATION );
> ClearSensor( SENSOR_2 );
>
>
>
> //
> fgWalk = 0;
> fgSit = 0;
>
>
>
> while(true) {
> ClearMessage();
> until( Message() != 0 );
>
> switch( Message() ){
> case 1:
> if ( fgWalk != 0 ) { // ൡà¢Ä¢êÎB àÌð~ßÄtO
> wanwan();
>
> StopWalk();
> stop HizaMonitor;
>
> ClearSensor( SENSOR_1 );
> ClearSensor( SENSOR_2 );
> ClearSensor( SENSOR_3 );
>
> fgWalk = 0;
> wanwan();
>
> } else {
> //
> wanwan();
> Up();
>
> PlayTone( 294 * 2,10 );
> PlayTone( 462,10 );
>
> start HizaMonitor;
> start Walk;
> start Tail;
> wanwan();
> }
> break;
>
>
> // ¨·íè
> case 2:
> if ( fgSit != 0 ) {
> wanwan();
> Up();
>
> ClearSensor( SENSOR_1 );
> ClearSensor( SENSOR_2 );
> ClearSensor( SENSOR_3 );
> wanwan();
>
> } else {
> wanwan();
> StopWalk();
> Sit();
> wanwan();
>
> }
> break;
> }
> }
> }
>
|
|
Message is in Reply To:
| | Re: Troubleshooting RCX Problems
|
| "Mario Ferrari" <mario.ferrari@edis.it> wrote in message news:FyvIAK.8or@lugnet.com... (...) Here you go: -- Tim Courtney - tim@zacktron.com (URL) - Centralized LDraw Resources (URL) - Zacktron Alliance ICQ: 23951114 AIM: TimCourtne -- //---...--- (...) (24 years ago, 6-Aug-00, to lugnet.robotics.rcx)
|
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|