Flash Force Wiki Interactive browser →
Wiki / Protocols
#protocol#ir#spybotics#reference

Spybotics IR protocol

The Spybotics infrared protocol in two layers:

Together they let you both decode what Spybots emit and synthesize valid messages — pings, targeting, combat, VLL output, even impersonating RCX or the RC remote.

Message format

Every IR command is 4 bytes: [nBot] [command] [hiByte] [loByte]

Command table — send / отдача

The full command set (Messages.h). The same codes appear on the wire whether sent by a controller, a bot, the PC, or an RCX.

CodeCommandTypeparam1 / param2
0x00NoCommand
0x10StartGame
0x11GameCommandGame
0x12GetVarGame(request a variable)
0x13ValueGame(variable reply)
0x14WinGame
0x15LoseGame
0x16BlinkGame
0x17GiveGame
0x18TakeGame
0x1FFromRCX2Gamecommand issued by an RCX 2.0
0x21FireLaserFiretarget aspect / strength
0x22FireSpinnerFiretarget aspect / strength
0x23FireElectroNetFiretarget aspect / strength
0x31ReactTo GigaMeshReact (0x30+species)range / strength·time
0x32ReactTo SnaptraxReactrange / strength·time
0x33ReactTo ShadowstrikeReactrange / strength·time
0x34ReactTo TechnojawReactrange / strength·time
0x41MagnetTell (token)0 / time
0x42RepulseTell0 / time
0x43FlashBlindTell0 / time
0x44FreezeTell0 / time
0x45SlowTell0 / time
0x46ReverseTell0 / time
0x47DizzyTell0 / time
0x48TakeControlTell0 / time
0x50UserUsercustom frame (see envelope)
0x60Spare
0x70VLLVLL outdrives a Micro Scout / Code Pilot

Transmit envelope — how a message goes out

Set in the firmware message[] table (Spybot.h):

Field (index)Values
iTxType (23)Spybot=0 · RCX=1 · RC=2 · User=3 — transmit as a Spybot, an RCX, the RC remote, or custom
iTxChannel (25)FrontLeft=0 · FrontRight=1 · Back=2 · HighPower=3 · PC=4directional emitters
iTxBaud (24)2400=0 · 4800=1 · 9600=3
iIndex (21)flags Broadcast=0x80, Linkcast=0x40, InvalidRxIndex=0x20
User frameiUserPreamblePos (47), iUserPreambleLen (48), iUserChecksum (49: none=0/sum=0x04/zerosum=0x08), iUserBiPhase (50)
iLock (51)Unlock=0 · LockIR=1 · LockPC=2

Receive side — приём (what bots sense & emit autonomously)

Pings — autonomous ID beacons

Bots broadcast periodic IR pings carrying their ID. ping[iInterval] (9), 10 ms steps: Disable=0, Min=10, Default=25 (250 ms), Max=255. ping[iMyID] (10, R/O).

world[16] — the "radar" each bot builds from received pings

For every detected bot (up to cMaxWorldEntries=16):

Field (index)Values
iShortID (1)bot's short ID
iLinkID (2)link ID
iRange (3)Nowhere=0 · Anywhere=1 · There=2 · Here=3
iDirection (4)Left=0 · LeftOfCentre=1 · Centre=2 · RightOfCentre=3 · Right=4 (centre split only in the Here zone)
iAspect (5)FrontLeft=0 · Front=1 · FrontRight=2 · BackRight=3 · Back=4 · BackLeft=5
iInfo (6), iNote (7)extra info / user note

A target[] table mirrors these fields for the currently-targeted bot. iRxChannel (20): source = IR=1 / PC=2.

Events fired on receive (Events.h)

Bump (bumper) · Enter (a bot entered range / world.enter) · Target (target change) · Post (message received) · Blink (opto / light sensor) · VLL (VLL received).

IDs & species

Control nuances

Programming "beads" (high-level blocks → compile to these commands)

Combat: FireLaser, FireSpinner, FireElectroNet, SendMindControl, Shocked, Take, Give, DeactivateAnyToken · Movement/goal: AdvanceForever, RetreatForever, GoalPointTo, GoalPointToward, GoalTurnAway, Power, Limit, Monitor{Dir,Vector}, ShowDir, TargetID · Sensing: CountBots(/Mode/Range), CountControllers(/Range) · Game/score: Score, Points, Penalty, GameOver, Won/LostGame, UpdateEndGame, Clear{Game,State,User}Timer, Resend, Note · Code-puzzle: CodeClue, RandomCode, DisplayCodeGuess, PlayCodeGuess · LED: Full/Red/GreenScale, Yellow · Misc: RndVar, PlayWait, StopAll.

Source / provenance

Logical layer decoded from the Spybotics CD-ROM (Internet Archive: lego-spybotics-englishdata2.cabProgram Files/Include/*.h). Physical layer: JorgePe — ir-spybotics · ofalcao — decoding old LEGO IR. See Spybotics, 76 kHz IR family.