Can the BrainPad code itself?

We have had this thought for many years… “Why do we need a PC to code?”. The BrainPad is more powerful than our first PCs and it can easily run BASIC, so why not connect a USB keyboard to a BrainPad and start coding it without using a PC?

Not only code, we can even step through code! We can build an IDE to step, debug and even inspect variables…yes right onto the BrainPad itself, without a PC.

So what language should be support? BASIC takes you back 50 years but it is VERY easy. Python is powerful and somewhat easy but still not first-step-friendly. What other options are out there? Do we teach coding with curly brackets or not? C is the mother of all languages, why not teach C?

None of the options are good “friendly starting point”. So let us make something BASIC-like C-friendly language. It should not be made to make us (developers) happy. It should be made so the average person feels like a real programmer quickly. It is made to show the user how computers “think”. And it must have the cool BrainPad’s instant-gratification user reward.

Turn an LED on… no more than a line
PINSET P3, HIGH

But then you can write it like this and it will still work
PinSet (P3,High);

What about a loop?

// curly brackets are optional!
WHILE
PINSET P3, HIGH
SLEEP 300
PINSET P3, LOW
SLEEP 300
ENDWHILE

// note how we ignore semicolons
while(1==1){
PinSet(P3, High);
Sleep(300);
PinSet(P3, Low)
Sleep(300)
}

We already have some interested community members, who are making this happen.

There are 2 sides to this development:

  1. the visual user interface (the IDE) running on a tiny display
  2. the interpreter. For reference, this BASIC interpreter is written in C# and already tested to work in TinyCLR. It might be a good starting point. https://github.com/Timu5/BasicSharp

Finally, here is a repo to get the project going https://github.com/ghi-electronics/k-basic

ezgif-4-6d02ec9a831d

5 Likes

Update: I got too excited and replied before I realize you already identified the language structure you were after. You can ignore most of what I said below except where I say “I think this is a cool idea” that still stands :slight_smile:


I think this is a cool idea. I would vote for a subset of Pascal as a good teaching language.

I am NOT recommending this, but another favorite of mine is Forth. Years ago I did a native implementation that ran on the Hydra boards.

mmm, I need to get a new board that runs the new TinyCLR.

2 Likes

That is really cool! I think BASIC is the best option, simple and too the point.

(Some day I would like to see Phython scripting in TinyCLR but that is for a business product not teaching.)

Does the BASIC interpreter handle line numbers? When I was learning to program in school the line numbers helped me learn and made it easier to copy code from books. When typing in lengthy code it is fairly easy to accidentally skip lines when you don’t have the line numbers.

Ha ha. I knew some of us will see this as a way to bring back childhood memories.

While this would be great, we must think of this from a new programmer’s perspective. It is not BASIC and it is not fortran but a language that is inspired by everything we loved when we started to learn to code.

I would vote for ‘basiC’

Basic methods like you show. Ditch the basic syntax While …ENDWHILE
Use C-syntax…curly brackets, semi-colons, (1 == 1), etc.

time before “not to long”

used and tested “and tried/compiled somehow for NucleoF411” but it was little hungry memory and part of commands do not worked

https://github.com/BleuLlama/TinyBasicPlus and it was derived from Tiny BASIC for the Motorola MC68000

1 Like

Algol 60, must be a contender. That’s what I learned first, then BCPL, then ‘C’, then C#

Mind you I quite like the idea of going back to Forth because its just so extensible.

2 Likes

So rare to find someone else interested in Forth. About a month ago I did a Z80 implementation, it was just a toy exercise to my Z80 skills up to par while I wait for my ZX Spectrum Next to arrive…

3 Likes

I vote for Picaxe Basic from the UK, thats how I started into programming micros.

1 Like

As I mentioned, the idea of this really excited me so on Saturday I sat down and started prototyping a small language, this project was started from scratch and I chose not us use any libraries or references as a starting point simply because I so rarely get to code these days it was more fun just to jump in and get started.

Here is a quick video that shows off what I have so far, next up I need to get a BrainPad.
https://youtu.be/M6p56Lr1fTk

Ignore the name for now. It was just something to start with before I even fully considered the structure of the language I was going for.

9 Likes

I knew someone will see the value and jump in and help. Very exciting :grin:

Gus, is the plan to implement this using TinyCLR or are you thinking that it should be a native implementation?

I have been out of the GHI ecosystem for a while, so I am not sure what the trajectory of TinyCLR is. I saw a few posts mention that only TinyCLR 1.0 is supported on the BrainPad, hence my question. Assuming that is correct and up to date information, Is GHI going to provide future support for BrainPad with TinyCLR or would going native be a better option?

I see where the confusion is, sorry. This is a general thinking for the further and not on existing BrainPad.

If we started from zero and we wanted to make a device that anyone can use to code, even non coders. I also wanted this device to let you program it using a true modern programming environment/language. We also want for a user to be able to grow and build on f same existing and growing knowledge… what device we would need?

The answer to me is a board that runs TinyCLR and then you can use C# for serious coding but then i start with an interpreter than run BASIC. A beginner can code it very easily. But then if we are writing an interpreter, why use BASIC or Fortran? Why not design a better language? By better I do not mean more features. I mean a language that is forgiving, where users may or may not use curly brackets and semicolons. A very limited and very forgiving language.

1 Like

I think it is a great idea and I am interested to see where it goes. The one advantage to sticking with BASIC is the repository of examples that are available; as well as the number of people that already know and can teach it. (Albeit that group is getting older.)

But on the other hand, a new language allows for the use of more common terminology and constructs.

Gus, thanks for the explanation, that makes sense. I think it is a great idea to make a device that is directly and easily programmable. I look forward to seeing what you offer for the next generation BrainPad, it sounds like fun.

1 Like

I have thought about it. Existing code is not made for IoT and hardware. If there is a decent code then it is a game or something too complex to use to learn and it will not run anyway for speed and display size anyway. Sand for those people that already know BASIC, they can learn this language is half an hour because it is based on BASIC.

Finally, learning BASIC doesn’t transition to C or Java easily. We need a language with no curly brackets for starter but then they are added later when the user is ready. Please see GitHub.

3 Likes