Decent BASIC compiler?

I’ve been messing with electronics as a hobby for years. I have worked with the BASIC Stamp and PIC microcontrollers with PicBasic and enjoyed it. I am dyslexic and more modern languages just don’t work for me - a hobby needs to be fun and spending hours looking for an error that looks right at first glance just isn’t fun. I don’t need much, most of my projects are just a couple dozen lines of code turning something on and off in a timer, flashing lights or sending PWM to a small motor or RC servo. Is there anything that would allow me to use the BASIC language on all these cheap little Arduino boards floating around amazon?

Keep seeing these type boards everywhere, would be great to be able to use them.

I am confident when you go through the examples in the Arduino IDE, you will be able to understand the C++ code.

Blink a LED:

// LED_BUILTIN is pin D13

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second

I thought QB45 was the last language I would ever learn. I was wrong. If you are reasonably familiar with QB45, you have good grounding for C++. One of the biggest initial problems is the jargon. I don't know anything about PIC, but I thought BASIC Stamp was an expensive mistake, and was thankful to find Arduino.

Persevere. And note all the libraries available, which means most of the really difficult stuff is done by somebody else.

I’ve tried multiple starter kits and instruction books on C, C++, python for PC, Pic and Arduino and ended up selling them all after hours of frustration and going back to PicBasic. And as for the basic stamp, if they weren’t $$$$$$$ I’d have dozens of them. Unless anyone knows a compiler that doesn’t error out if all the (){} and spaces aren’t exactly right. The BASIC compilers I’ve used are very forgiving to an extra space or missing ) where others I’ve tried have to be perfect.

Dyslexia is very annoying. Show me 2 identical programs, one formatted right and another with numbers switched around and spaces missing and it’ll all look the same to me until I’ve carefully studied both in detail several times. This means one simple format error can take me hours or more to find and correct. I’ve heard of simple BASIC compilers that work on Arduino, sacrificing performance and some memory to make it happen. I’m fine with 1kb left for code - can’t remember the last time I needed more. I just can’t remember what they were called or where I saw them. I’ll keep trying C++ but I need a backup option to get a few things going if I continue to have trouble.

Found one. Anyone have experience with TinyBasic?

You could try Visual Studio Code instead of the Arduino IDE. It has much better syntax highlighting with clearer colors, and it clearly shows you matching parentheses and brackets. You can also fully configure the style, choose an easy to read font, contrasting colors, etc.

In my eyes, the best feature is that it will tell you immediately if you've messed up some bracket or misspelled a variable name, using red squiggly lines in your code, while you type, so you don't have to dig through tens of lines of compiler output. It also has IntelliSense to show auto-completion, which is extremely helpful.

Also keep in mind that the C++ compiler mostly ignores whitespace. It doesn't matter if you use 1 space or 8 between two words, maybe it helps to have the different parts further apart to make it easier to read? You can configure the auto-formatter to move each bracket on its own line, or add spaces in parentheses, for example. VSCode uses clang-format. You can configure it by creating a .clang-format file in your project/sketch folder.

I think the compiler being strict is actually a good thing. It's easier to debug a mistake that the compiler tells you about than a mistake that causes problems at run-time.
A compiler that incorrectly fixes your brackets or parentheses is not a good compiler.



There are a bunch of BASIC projects for avr, as well as some rather expensive commercial offerings.
I don’t know anything about any of them, though.

Going to look into visual code studio, that might just solve my problem, 4 parentheses and 5 parentheses look the same to me, and BASIC usually didn’t make me stack them out that far. Also good to know it’ll ignore extra spaces, I used double/triple spaces a lot in BASIC to help keep things from getting mixed up. Found a $5 development board I’m going to try, that way I’m not really risking anything. Last time I was into programming Arduino was pretty new and those boards were still $25 or so.

Checked the sourceforge link (can’t quote for some reason), I recognize one of the compilers, used a version of it on Pic microcontrollers. Wasn’t great but got the job done. If visual code studio doesn’t do the job I have my back up plan. Thanks!

4 parentheses and 5 parentheses look the same to me, and BASIC usually didn't make me stack them out that far.

Nor does C++ if you don't want it to and even the humble Arduino IDE will indicate matching brackets of all kinds if you position the cursor next to one of a pair. If a matching bracket is not indicated or it is not where you think it should be then something is wrong.

I remember reading the source code for Tiny Basic (Tom Pitman??) in Dr. Dobb's Journal (I think) and being very impressed with all that was packed into about 4Kb...some very clever assembler code there. However, I haven't looked at Basic for quite some time, but if TB works for you, why not.

Been messing with my new Arduino pro micro boards for a couple days. The IDE has improved significantly since my last attempt in the early days. Dyslexia definitely messes with me but not nearly as much. Libraries are awesome, I’ve already built a couple pointless projects for fun (just to see if they’d work) that’d have been impossible on BASIC Stamp or Pic. For one I can set up an I2C 128x64 OLED display in about 5 lines of code, good luck getting it working at all on a BASIC Stamp! Only thing I’ll ever use BASIC for again is simple LED flashers (bike lights and similar) and then only because I can use an 8 pin DIP Pic microcontroller (with PicBasic student) with zero extra parts needed.

Only thing I’ll ever use BASIC for again is simple LED flashers (bike lights and similar) and then only because I can use an 8 pin DIP Pic microcontroller (with PicBasic student) with zero extra parts needed.

The Arduino environment is not limited to Arduinos; with some additional setup of the IDE, you can use an 8-pin ATtiny85 :wink:

Good to know, I’ll do some research. It’d be cool to have a couple tiny 8 pin microcontrollers again. Custom manufactured printed circuit board with connections to 6-8 LEDs (driven as 3 or 4 pairs) and an 8 pin DIP chip (1 square inch) is only $5.

An 8pin microcontroller can drive 20 LEDs and have a pin left over to use as an input: