[Tutorial][Beginner]1."Hello World!" - making your first program

1. The basic “Hello World!” program

In this lesson we will learn the basics of how to make your first program on Pokitto.

The program will put a simple text “Hello World!” on the Pokitto screen.

2. FemtoIDE programming environment

  • Pokitto has a full programming environment called FemtoIDE (by Felipe Manga)
  • FemtoIDE works in Windows, Linux, MacOS (also beta test version available for RaspberryPi)
  • get FemtoIDE release for your operating system from https://github.com/felipemanga/FemtoIDE/releases

3. Programming in FemtoIDE

  • After installation, open FemtoIDE
  • press “New Project” button
  • give a project name, for example “HelloWorld”
  • see that the chosen Template is “1-C++ Game”

4. “Hello World!” source code

  • delete the existing code in the main.cpp file (has opened automatically for you)
  • copy the code below into the window
  • then click menu “Simulator” and “start”
  • the program will run as a simulation on your PC - exactly as it would run on Pokitto!
#include "Pokitto.h"

Pokitto::Core mygame;

int main () {
    mygame.begin();
    while (mygame.isRunning()) {
        if (mygame.update()) {            
            mygame.display.println("Hello World!");
            } 
        }    
    
}

5. Compiling the program for Pokitto hardware

  • now choose “Pokitto” from the dropbox next to the “Simulator” menu in FemtoIDE
  • this means the building target is now real Pokitto Hardware
  • now choose “Build” - > “Run”
  • FemtoIDE will build a binary, meaning a native program that can run on Pokitto hardware
  • this binary is a file with a name ending in .bin in the project folder
  • FemtoIDE will open PokittoEmu emulator and try to run the bin
  • if everything is Ok, “PokittoEmu” will open up and start emulating your program exactly as it would run on Pokitto

6. putting the .bin binary on to a real Pokitto device

  • now you can put the binary on a real Pokitto
  • there are several ways of doing it, depending on your OS
  • see instructions below:

7. More tutorials

1 Like

seems to be a problem

Error: “PokittoLib/mbed-pokitto/targets/cmsis/TARGET_NXP/TARGET_LPC11U6X/TOOLCHAIN_ARM_MICRO/TARGET_LPC11U68/LPC11U68.sct”, line 3 (column 9): Error: L6235E: More than one section matches selector - cannot all be FIRST/LAST.

Error: Not enough information to list the image map.

1 Like

Thanks, will fix it right away

EDIT: can not replicate issue

I am unable to replicate issue. If program contains PokittoLib from https://os.mbed.com/users/Pokitto/code/PokittoLib/ , every one of them compiles without issues.

Please check you do not have some sort of local copy and check that Pokitto/PokittoLib is where the library is coming from.

EDIT:

Could not replicate even with a second non-admin account I keep for testing

my bad i still had the mbed-src in there

do need to cover that you need to make a my_settings.h file

1 Like

Just wanted to share a quick error we had in case someone else gets a similar error. After importing the project you must ensure that LPCXpresso11U68 is the selected platform. I had a different device selected from a different project of mine a long time ago which I had forgotten about. So we had a bunch of compiler errors.

So in step 6, it’s a good idea to ensure you have LPCXpresso11U68 listed on the top right as shown in jonne’s image. If not, click on it and you should be able to select it as the target if you added it as a compiler option correctly in steps 1-2.

2 Likes

Finally picked up a beginners C++ book :wink:

Will hopefully be joining the rest of you with programming skills soon-ish :innocent:

3 Likes

I have tried the steps above but only receive a black screen when I compile and load the program onto the pokitto using either the USB card or directly in program mode.

Does the Hello World project work for anybody else? I get the same as @TigerJ, but I assumed I’d broken it somehow. I think it broke with a library update.

I have done heavy editing so it is possible. I will check it out

I am not able to replicate this issue. Could you try this binary ? I just made it in the mbed compiler and it works 100% for me.

HelloWorld_LPC11U68.bin (28.6 KB)

Still a black screen. When I load other programs that came on the usb card it works fine. Just the hello world program seems to be a black screen. I added it to the usb card. I used windows for this after reading a few posts about a white screen and special mac loaders.

1 Like

Ok. I’m trying to understand where this problem is coming from.

  1. when do you get the black screen?
    a) no pokitto logo at all
    b) after pokitto logo (no sound level selection)
    c) after sound level selection screen

  2. please flash the binary below to your pokitto, then try the hello world again

  • any difference?

start.bin (256 KB)

The hello world results in B, after pokitto logo, no sound selection.

the start.bin gives me the eyes and mouth animating on the screen. (fully functional)

after the start.bin I receive the hello world and IT WORKS! yay

(what happened?)

1 Like

The Eeprom (where settings are) was uninitialized and contained random numbers. Start.bin forces settings in place.

I now know exactly where the problem is, thank you very much for your help

2 Likes

Every time I click the compile button there is an error message:

Error: ‘#pragma import’ is an ARM Compiler 5 extension, and is not supported by ARM Compiler 6 [-Warmcc-pragma-import] in “PokittoLib/mbed-pokitto/common/retarget.cpp”, Line: 34, Col: 16

Hi @seoulsaram!

This tutorial is in need of updating, sorry.

The error is caused by changes in the online compiler at mbed.

It is easier (now) to start with FemtoIDE which is a complete package for programming Pokitto with C++, micropython or java

[Tool]FemtoIDE

When you open FemtoIDE, you will be taken directly to example projects

I just tried the example and it compiles in mbed online too.

Let me find out why it was not working for you.

EDIT: the example program also runs ok

Hi. The examples work fine when I try. Are you using the mbed online compiler?

Here’s a captured screenshot from what I can see… I tried same steps with tutorial but I have no idea.

2 Likes