Have any questions?

+44 (20) 3540 6226


LOGO Command Reference

5.0/5 rating (3 votes)

The LOGO commands are used for controlling the AppCar and other Robotics & IoT projects by AppShed.



The following commands are used for driving the AppCar. They will control two motors to achieve different driving directions:

FD x (or FORWARD) - Move forward x millimeters, Example: FD 100
BK x (or BACK) - Move Backward x millimeters, Example: BK 100
LT x (or LEFT) - Rotate the turtle x degrees left, Example: LT 45
RT x (or RIGHT) - Rotate the turtle x degrees right, Example: RT 45
ARCFL x Move in an arc going forward and left for x degrees, Example: ARCFL 45
ARCFR x Move in an arc going forward and right for x degrees, Example: ARCFR 45
ARCBL x Move in an arc going backward and left for x degrees, Example: ARCBL 45
ARCBR x Move in an arc going backward and right for x degrees, Example: ARCBR 45
ST x (or STOP) - Stop moving both motors

Motor Control

Motor control is similar to driving, but only controls one motor at a time. This can be used for other purposes, such as turning a winch/pulley. 

Output Pins

Each of the pins can be controlled and set to different values. Pins can be used for the following purposes:
  • Digital - set a pin to 1 or 0 (on or off)
  • Analog - set a pin to a value from 0 to 1023 (this is the range from off to fully on)
  • Servo - set a servo pin to degrees of rotation 0 to 180


Set a pin to 1 or 0 (on or off)

D0 1/0


  • D5 0
  • D8 1

The same applies to all pins: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9



Set a pin to a value from 0 to 1023 (this is the range from off to fully on)

A0 0-1023 - Set pin A0 to value (no duration)


  • A3 753
  • A0 13

The same applies to all pins: A0 A1 A2 A3 A4 A5 A6 A7 A8 A9



Set a servo pin to degrees of rotation 0 to 180 (degrees)

SERVOx 0-180 - Set servo on pin x to 0-180 degrees.


  • SERVO8 135




Logic and Program Flow



WAIT x - Pause execution for duration (x).

No state change, all pins remain as they are. No further commands are executed until the duration passes. 

(This uses Arduino millis code but does not stop the loop() process.)



DELAY x - Pause execution for duration (x) for the entire device. All other  commands will also be paused during this time. No commands or loops will run until the delay is complete.

(This uses Arduino delay() function)



LOOP [ ... ] - Runs the code inside the brackets repeatedly, in a loop. 

Any Logo commands can go inside the brackets (except another LOOP). This allows you to repeat a command, e.g. checking the value of a pin. LOOPs are normally used to respond to changes in the value of a pin.

Example: Turn on LED D0 when A0 above a 500.

LOOP [ IF (A0 > 500) (D0 0) ]


Input Pins

Pins can be used as inputs. This is done when you need to read/discover the value of a sensor or button attached to the pin. For example, if a button is connected to pin 3, when the button is pressed, D3 will be 1.

D0 D1 D2 D3 D4 D5 D6 D7 D8 D9

Analog sensors (such as light sensors, temperature etc) can be connected to A0. The values range from 0 (completely off) to 1023 (completely on). There is only one analog input pin on the NodeMCU/ESP8266. e.g. the sensor valuu/reading on A0 might be 500.





Repeats allow you to repeat a block of code x number of times:

REPEAT x [...]

Repeat the code x times.


  • Draw a square w
  • ith 50mm sides
     REPEAT 4 [ FD 50 RT 90 ]
  • Wave the servo back and forth
    REPEAT 2 { SERVO7 180 WAIT 500 SERVO7 0 WAIT 500 }



  1. The number of repeats (x) must be an integer
    • Do not use very large numbers (e.g. over 10) as the code might fail... remember the Node has very limited memory capacity.
  2. The code must always be inside brackets.
    • You can use any brackets, e.g. [...] (...) {...}
    • You can put any code inside the brackets, including other IF statements (i.e. nested IF )


IF Statements

If statements check a condition and runs the code only when the condition is true.

IF x = y [ .... ]

If x equals y then run the code ... inside the brackets.


  • Go FD if pin 1 is off 
    IF D1 = 0 [ FD 100 ]
  • Turn servo 6 to 45 degrees if anlaog input greter than 520
    IF A0 > 520 ( SERVO6 45 ) 


  1. The condition must compare two values. You can use any comparators, including:
    • = (equal)
    • != (not equal)
    • > (greater than)
    • < (less than)
    • >= (greater Ythan or equal)
    • <= (less than or equal)
  2. The code must always be inside brackets.
    • You can use any brackets, e.g. [...] (...) {...}
    • You can put any code inside the brackets, including other IF statements (i.e. nested IF )
    • Make sure you have a pair of brackets. This can get confusing when nesting IFs, and nesting REPEATs.



You can create functions and call them from your code. This allows you to reduce the amount of code, and simplify repetitive tasks. For example the code to draw a square could be put into a function

  1. Save the code for the function in the Function Code Box
    (e.g. for Function 1, save the code in the input for FN1)
  2. In your main code box, you can call the function, e.g. FN1 FN2
    (This code will call function 1, then call function 2)
  3. Functions can use any code (IF, REPEAT, and other Functions.)
    DO NOT call a function from itself, so do not put FN1 into the code for function 1. This creates and indefinitely loop, and the universe will explode.


You can use variables with functions to set values. Variables are defined as :VARx (x is 0-9)
(NOTE the colon : before the VAR)

:VAR1  :VAR2  :VAR3  :VAR4  :VAR5  :VAR6  :VAR7  :VAR8  :VAR9


  • A function to draw a square has a variable to define the size of the square.
    Function 1: REPEAT 4 [ FD :VAR1 RT 90 ]
  • A function to wave a servo x number of times
    REPEAT 2: :VAR1 [ code to wave ]
  • Wave 3 times, going from 45 degrees to 135 degrees
    FN1 3 45 135
    Code:  REPEAT :VAR1 [ SERVO6 :VAR2 WAIT 500 SERVO6 :VAR3 WAIT 500 ]


  • If a function uses variables, you have to pass the variables when calling the function.
    e.g. FN1 50 (to draw the 50mm square)
    FN2 5 (to wave 5 times)
  • Functions can use multiple variables (up to 9)
  • You have to supply the correct number of variables, so check the function code to see which are required.


Other Commands


This will clear all the Logo code running on the device. 

Motors will stop. Any code that is currently running or in the queue will be deleted. The LOOPs will stop running.



This will display the value of a pin (or an expression) in the app.

DISPLAY DHT2.TEMP * 9 / 5 + 32

(This requires an input box on the screen. Set the Custom Class for the item to "logodisplay")







Share this product

appshed name white text 250

Copyright © 2017 AppShed Limited