Lego Power Functions extension for mBlock 5

My son and I did wrote an mBlock 5 extension to control Lego Power Functions.

It is based on the Arduino library from https://github.com/jurriaan/Arduino-PowerFunctions. The whole Power Functions is not implemented, there are only 2 blocks:

  • Begin Lego Power Functions : Select the pin connected to the LED, and the receiver channel
  • Lego Power Function : Select the output (Blue or Red), and the desired action (in continuous mode)

The setup is simple : Just connect an infrared LED and a 220 ohm resistor on a digital pin (13 by default).

Sample code :

To use it in mblock 5:

  • Add an Arduino board
  • Click « + extensions » in the block section
  • Search « Lego Power Functions » in  Sprite Extensions

Note : if your arduino board is more recent than the extension, the extension will not appear in the search results. Select another board.

Translations are welcome !

For french readers

Mon fils et moi avons créé l’extension mBlock 5 pour Lego Power Functions.

Elle est basée sur la libraire Arduino suivante : https://github.com/jurriaan/Arduino-PowerFunctions. Toutes les fonctionnalités ne sont pas implémentées, il n’y a que 2 types de blocs :

  • Démarrer Lego Power Functions :Indiquer la broche connectée à la LED infrarouge, ainsi que le canal du récepteur
  • Lego Power Function : Choisir la prise (Blue or Red) et l’action (en mode continu)

Le montage est simple, il suffit de brancher une LED infrarouge et une résistance de 220 ohms en série sur une broche (D13 par défaut).

Exemple de code :

Pour l’utiliser dans mblock 5:

  • Ajouter une carte Arduino
  • Cliquer sur « + extension » dans la section des blocs
  • Chercher « Lego Power Functions » dans les extensions du lutin

L’extension n’apparaitra pas pour les cartes Arduino publiées après l’extension. Dans ce cas, il faut choisir une autre carte.

Les traductions dans d’autres langues sont les bienvenues !

2 réflexions sur « Lego Power Functions extension for mBlock 5 »

    1. cyril Auteur de l’article

      Hello
      I’ve added the instructions in the article.
      I’ve just noticed that the extension is not available for newer arduino boards.
      I’ve pushed an update.

Les commentaires sont fermés.