[Start]4.Writing your first Pokitto program in the mbed online ecosystem


#1

In this video, we look at the very basics of how to write, compile and store a simple program for the Pokitto in the mbed online ecosystem.

There is now a ready-made Hello World! starter project available, all you need to do is to create an mbed account:

https://os.mbed.com/teams/Pokitto-Community-Team/code/HelloWorld/

  • 00:30 - logging onto mbed ecosystem
  • 02:00 - choosing a target board
  • 04:00 - starting a new program in the mbed online compiler
  • 05:45 - importing mbed and pokitto libraries
  • 07:30 - writing the “Hello World!” program
  • 11:00 - compiling the program
  • 11:40 - copying the binary to Pokitto device

ATTENTION: you no longer need to import mbed-src as shown in the video below - it is now included in the PokittoLib!!!


[Tutorial][Beginner]1."Hello World!" - making your first program
Learning to talk to Pokitto
#2

I must admit, I’m not a fan of online IDEs, but at least it looks reasonably straightforward.


#3

stage 2, offline ide coming also

@Hanski 's micropython was made with that

but i need to cobble up a guide for it first


#4

Good to know there’s an offline alternative.
I’ll probably stick to that when the guide’s available, but as long as there is a way to develop for now, that’s the main thing.
Rome wasn’t built in a day after all.
In a few months PokittoLib will probably have made it to page one of the search list.


#5

There are use cases where the online IDE is a good fit. For simple tiddling where you might want access from a number of computers, or for teaching students without needing to set up workspaces, it can be nice.


#6

Free opensource offline IDE was one of the first design considerations. What we will be using is EmBitz. Its free, ARMGCC based, robust and fully supports hardware debugging. I’ve used 5000$ alternatives and EmBitz doesn’t pale in the face of the expensive commercial options.

Tutorial on setting up EmBitz and the github mirror of PokittoLib (the same lib works both online and offline) coming within a week


#7

While I don’t mind online IDEs - well, any more than offline ones - what I hate is documentation that I can’t print out, highlight, add sticky notes to or bend the corners on.

Any chance of getting tutorials for people who like to read?


#8

It would be an excellent way to learn it by making a written tutorial :wink:


#9

Absolutely.

The way I try to work here with the community is to provide tools and information as fast as possible, even if the initial quality is low, then improve and redo the essential parts.

These videos are the quick answer, a long form answer will be made in the form of written documents.

The point is that I can make a video tutorial including editing in 2 hours, but writing a good document with pictures to illustrate key things takes much more time.

Edit: there is a ready-made Hello World! starter project available, all you need to do is to create an mbed account:

https://os.mbed.com/teams/Pokitto-Community-Team/code/HelloWorld/


#10

I think this is going to be fun :slight_smile:


#11

I’m not denying there are, but there are also cases where it’s not preferable, for example when you don’t have internet access or only have limited internet access or when your browser is playing up because you have too many tabs open.

If the internet goes down I want to be able to keep working on my project whatever that may be.

I haven’t used it before, but the feature list looks promising.

I’m not surprised to be honest.
When I last bought a new computer (less than years ago) and found out Microsoft want people to get MS Office on a subscription basis I switched to LibreOffice and I’ve never looked back since.


#12

Youtube is blocked at my work. I can’t watch the video. I created an mbed account and I’m trying to add a board but I can’t seem to find the LPC11U68 that Pokitto is supposedly using? What’s the target board to be chosen at mbed.com?


#13

LPCXpresso11U68 :slight_smile:


#14

first import “mbed-src” library, then “PokittoLib”

after that you can write code


#15

Thanks :wink: that’s what I did but before that I needed to select the board “LPCXpresso11U68” as indicated by NullMember!


#16

I cant seem to get 16 colours working on the device.
even with a pretty empty project I get a warning about colordepth so maybe that might have something to do with it:

Warning: Incompatible redefinition of macro “POK_COLORDEPTH” (declared at line 189) in “PokittoLib/Pokitto_settings.h”, Line: 249, Col: 22

this is my ‘hello world’, seems to be running in 110*88 so it should be running in colordepth 4, im loading a 16 colour palette, but its only using 4 colors on hardware.
any ideas?

 #include "Pokitto.h"
 Pokitto::Core  pk;

 int Xpos = 0;
 int main ()
 {
     pk.begin();
     pk.display.persistence = 1;
     pk.display.loadRGBPalette(palettePico);
     while(pk.isRunning())
     {
         if (pk.update())
         {
             if (pk.buttons.repeat(BTN_A,0)){ 
                 pk.display.persistence = 0 ;
             }
             else {
                 pk.display.persistence = 1 ;
             }
             pk.display.setColor(rand() % 15);
             pk.display.fillRectangle(rand() % 110, rand() % 88, rand() % 110, rand() % 88);
             
             pk.display.fillRectangle(Xpos, 0, 10, 10);
             
             Xpos++;
             if (Xpos > 150){
                 Xpos=0;    
             }    
         }
     }
 }

#17

oh hang on, just found ‘my_settings.h’
oddly, it was set to proj_hires = 1 (which wasnt reflected on the device oddly, it was still showing 110x88)

but I set that to 0 and the 16 colours became visible. so… err. fixed!


#18

my_settings.h is needed because project command line settings are not persistent across sessions in online ide


#19

This sort of left me boggled for a while. I can get the first draft of such a document done in about two hours (I made end user tutorials and videos for FP Complete’s online Haskell IDE, so have some experience here). For something like this, pictures are just screen shots, so easy. Not done, but over half way there. Otoh, it takes about the same amount of time to write the script for a video. For something like this, I’d probably use the same set of screen grabs in the script as the document. The script might be done, but I’ve still got recording and editing to do, so maybe 1/3rd of the way to the video if I’m lucky. Can you turn out useable video without a script? I can’t - trying that is simply a waste of time.


#20

What’s a script? I think that answers your question.