Painting Robot – Coding

How to program the Painting Robot and prepare a workspace for painting.

Connecting electronic modules

1. Connect the motors to the M1 and M2 ports of the LOFI Brain. Make sure the small metal walls inside the pins of the motor cables are facing the plastic walls of the pins on the controller.

2. Connect the powerbank to the micro USB slot on the Adapter.

lofi brain zasilanie powerbank

3. If you are using a Bluetooth module, connect it to the corresponding slot on the adapter. Make sure you put the module in the right direction, see the picture below.

4. Connect the servo motor to OUTPUT 1 (if you connect it to OUTPUT 2, you will be able to control the hoist with our LOFI Control mobile app).

5. Connect the green LED to OUTPUT 2 and the red one to OUTPUT 3.

Program for manual drawing

The code

How to prepare your workspace and paint

1. Put a large piece of thick paper, preferably cardboard, on a flat and even surface. This will serve as a canvas for painting.

2. Put the robot on the canvas and turn the switch on LOFI Brain to ON position.

3. Connect LOFI Brain with LOFI Blocks. It’s best to do it via Bluetooth module if you have one.

4. Make sure you have the script put in LOFI Blocks. Then press PLAY.

5. Press the down arrow to set the hoist to the bottom level. Insert the felt-tip pen inside the holder so that it touches the canvas. You can now steer the robot with arrow keys and paint at the same time.

6. In order to move without drawing, press the up arrow – this will lift the felt-tip pen.

Program for automatic drawing

The code

The first part of the script is responsible for the movement of the robot. The rest of the blocks controls enables setting the level of the felt-tip pen.

  • “Z” – sets the felt-tip pen up and enables the painting script.
  • “Up arrow” – gradually lifts the felt-tip pen every time it’s pressed.
  • “Down arrow” – gradually lowers the felt-tip pen every time it’s pressed.
  • “X” – “emergency button”. The Painting Robot stops and lifts the felt-tip pen.

How to prepare your workspace and paint

1. Put a large piece of thick paper, preferably cardboard, on a flat and even surface. This will serve as a canvas for painting.

2. Put the robot on the canvas and turn the switch on LOFI Brain to ON position.

3. Connect LOFI Brain with LOFI Blocks. It’s best to do it via Bluetooth module if you have one.

4. Make sure you have the script put in LOFI Blocks. Then press PLAY.

5. Press “Z” key. The robot will start moving but it won’t paint yet.

6. Keep pressing “down arrow” until the arrow touches your canvas and starts to paint. If the felt-tip pen is set too low, it will block the robot’s movement. In that case, just adjust the level of the felt-tip pen by pressing “down arrow”.

7. In order to stop painting, press “X” key. The robot will stop the motors and lift the felt-tip pen.