Notifications
Clear all

Basic Programming Language for Arduino*

14 Posts
3 Users
10 Likes
1,072 Views
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
Topic starter  

G'day friends!

Who knew that there was Basic available for Arduino?
What a revelation!

Not me, that's for sure, but the explorer I am... look what I found!!!

B4R Amongst Others

Anyway, posting this not only because I was a big fan of Basic / Visual Basic, but I know that there are at least 1 or 2 members here (and maybe more), who really like this language, and I do too!

But, who knew he? πŸ™‚

What do you think?

I like it!


   
Ken and robotBuilder reacted
Quote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 

@frogandtoad

The robot in the icon image I use with my posts was programmed using FreeBASIC,Β  a language I have used for over 10 years.Β  It compiles to very fast code so I was able to write fast visual processing software that would normally have required c++.

https://forum.dronebotworkshop.com/user-robot-projects/k8055-robot/#post-4101

Although I like the BASIC language (modern versions) I am not adverse to using C++ for the Arduino as it is also the language I used to use on the PC.

I downloaded B4R on the PC but really couldn't figure out how it is used, no simple beginner tutorials. It is unclear for example how I would write and install on the Arduino a BR4 version of an Arduino C++ program.

Β 


   
frogandtoad reacted
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
Topic starter  

@robotbuilder

Posted by: @robotbuilder

@frogandtoad

[snip]

I downloaded B4R on the PC but really couldn't figure out how it is used, no simple beginner tutorials. It is unclear for example how I would write and install on the Arduino a BR4 version of an Arduino C++ program.

Β 

Β Really? there are tutorials, and not very difficult, actually...Β 

For example: installation

Just run the .exe, and provide your relevant parameters, and should be good to go?

Cheers


   
Inst-Tech reacted
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 

@frogandtoadΒ 

For some reason I find navigating the modern web page difficult.Β  I looked at that page and went to

https://www.b4x.com/etp.html

it talks about a mobile phone so does it compile stand alone code for the Arduino or does it require a mobile phone to be part of the solution?

I don't see an example written with the Arduino IDE followed by its equivalent written in BXR pop out at me just talk about web pages forms frameworks ...

Where is the setup and loop function?Β  A direct one to one translation from Arduino c++ to BASIC.Β  I assumed a simple Arduino BASIC IDE.

So I will just stick to using Arduino C++ IDE to code the Arduino.

Β 

Β 


   
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 
Posted by: @frogandtoad

@robotbuilder

Posted by: @robotbuilder

@frogandtoad

[snip]

I downloaded B4R on the PC but really couldn't figure out how it is used, no simple beginner tutorials. It is unclear for example how I would write and install on the Arduino a BR4 version of an Arduino C++ program.

Β 

Β Really? there are tutorials, and not very difficult, actually...Β 

For example: installation

Just run the .exe, and provide your relevant parameters, and should be good to go?

Cheers

As a user of VB and VBA for many years, I find this B4XΒ  somewhat intriguing , but the limitation of some of the functions , like string manipulations, and memory allocation of variables in Dim statements look to be somewhat daunting and complex as compared to VB..

Having said that, I'm still trying to learn C++ for Arduino, so I'll just keep moving forward on this until I get a good handle on how to efficiently use C++.. Thanks for posting this information..

regards,

LouisR

Β 

LouisR


   
frogandtoad reacted
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 

@frogandtoadΒ 

Thought I might still have a play with language so I also installed B4R

Loading one of their examples I hit my first obstacle, path configurations, something that always gave me trouble. Fortunately with some other languages this is automatic and requires no inner knowledge of how to do all that stuff.Β  Often I get DO x with the assumption you actually know how to do x and no option to have it explained.

With FreeBasic I just choose Save As and then navigate to the desired location in which to save the program.

To enlarge image, right click image and choose Open link in new window.

Β 

B4R

Β 


   
Inst-Tech reacted
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

@robotbuilder Yep.. nothing is ever easy that is worth while..hence, the quest to learn is ever on-going..

I think I'll wait awhile before trying to tackle a new version of VB like B4X.. let us know how it works for you.

The coding it getting easier all the time.. pretty soon, the machines will be doing it all for us, and we will be learning nothing..sad...

regards,

LouisR

LouisR


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 

@inst-techΒ 

Yep.. nothing is ever easy that is worth while..hence, the quest to learn is ever on-going..

And then you die and all that learning vaporizes πŸ™‚Β  People do like a challenge. They even create conflict (sport) to satisfy that need.

However if you make it hard when it doesn't have to be hard you just prevent yourself achieving more.

Imagine if you didn't have the Arduino development system to program the ATmega328P and instead had to use a hex key and machine code like I had to do in the early days with the 8085.

Making it easy means making it possible for more people to achieve more in less time than they would have done otherwise.Β  I could be up and running with B4R right now instead of having to find time to figure out these path configuration requirements.

When Windows came out programming something that was easy with QBASIC became very very complex requiring a deep understanding of C++ and its Window's API programming environment. Then along came FreeBASIC and you could write the same program with a few statements. Same result, one requiring a year's training, the other a week's training.

A simple but well supported language I would recommend to anyone wanting to interface to their hardware is the Processing language. Unlike B4R it is well supported with lots of easy tutorials and library support. It's IDE is like the Arduino C++ IDE.

https://processing.org/

The coding it getting easier all the time.. pretty soon, the machines will be doing it all for us, and we will be learning nothing..sad...

This AI writes code from a written request.

Β 


   
Inst-Tech reacted
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

@robotbuilderΒ 

"Imagine if you didn't have the Arduino development system to program the ATmega328P and instead had to use a hex key and machine code like I had to do in the early days with the 8085."

Yep.. remembers those days too!.. Wrote my first machine code for my old TRS-80Β  16 k and Zlog 8080 compiler back in 1979. It was a clock on the monitor display...it worked pretty well except when you used a for-next loop statement, it stopped the clock and lost some time.. I didn't know about IRQ's then, so had not considered it obviously...lol

It worked by inserting a jump instruction into the 55 byte code for the keyboard de-bounce routine..Indeed, I know all about how to do things the hard way..but it gave me insights into how the processor worked, and made it easier to advance my knowledge of programming in general.. But don't get me wrong, easier is a good thing, but I just like to know things.. it's the technician in me I guess.. Troubleshooting is an art that I learned over 50 years ago..I'll get around to this BR4 thingy soon enough..just right now I have to contend with learning C++ a bit more so I can use my PID control algorithm on my tank robot to make it more autonomous..Β 

regards,

LouisR

LouisR


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
Topic starter  

@robotbuilder

Posted by: @robotbuilder

@frogandtoadΒ 

For some reason I find navigating the modern web page difficult.Β  I looked at that page and went to

https://www.b4x.com/etp.html

it talks about a mobile phone so does it compile stand alone code for the Arduino or does it require a mobile phone to be part of the solution?

I don't see an example written with the Arduino IDE followed by its equivalent written in BXR pop out at me just talk about web pages forms frameworks ...

Where is the setup and loop function?Β  A direct one to one translation from Arduino c++ to BASIC.Β  I assumed a simple Arduino BASIC IDE.

So I will just stick to using Arduino C++ IDE to code the Arduino.

Hmm, not sure how you ended up at that page exactly, but the link I provided gave the exact installation and config details you need to get going right away?

Where is the setup and loop function?Β  A direct one to one translation from Arduino c++ to BASIC.Β  I assumed a simple Arduino BASIC IDE.

As this is an IDE for using Basic, there is no Setup() and Loop() functions per se, but there is an AppStart sub routine which acts like the Setup() function in Arduino, and you can code the Loop() function yourself if you want it, but better without it and using timers or both if you want.

Cheers


   
Inst-Tech reacted
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
Topic starter  

@robotbuilder

Posted by: @robotbuilder

@frogandtoadΒ 

Thought I might still have a play with language so I also installed B4R

Loading one of their examples I hit my first obstacle, path configurations, something that always gave me trouble. Fortunately with some other languages this is automatic and requires no inner knowledge of how to do all that stuff.Β  Often I get DO x with the assumption you actually know how to do x and no option to have it explained.

With FreeBasic I just choose Save As and then navigate to the desired location in which to save the program.

To enlarge image, right click image and choose Open link in new window.

Β 

B4R

Β 

Again, the link I provided stated that you need to configure the path and select the board etc... before you can use it, so I'm not surprised you got that message.

I set mine up using those instructions (it was very easy... you should know the path to arduino.exe and your sketch folder for library path), and was able to download a simple blink sketch and run it immediately without issue - I then played around a little with it and came up with some additions to it, as well as renaming bits and pieces to suit myself.

Here is the example I compiled and ran a short time ago, which is Basic in nature πŸ˜‰

B4R Project 1

Log writes directly to the serial object as well, as the following putty connection demonstrates:

B4R Project 1b

Cheers


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 

@inst-tech

Wrote my first machine code for my old TRS-80 16 k and Zlog 8080 compiler back in 1979.

Two oldies πŸ™‚ Good old TRS-80. I remember buying it wondering if I would really be able to program it. Good documentation and tutorials made it easy. My first assembler code was my version of the draw line function. I used fixed point by treating the BC, DE, HL as fixed point variables B.C, D.E, H.L which I thought was clever at the time, it was only later I came across the Bresenham algorithm.

C++ is a great language despite its awkward squiggly brackets and Arduino C++ is really easy to use. I started with Turbo C++ on the old MSDOS machines.

Β 


   
Inst-Tech reacted
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 

@frogandtoadΒ 

Thank you for your patient reply.Β  At the moment I am working on other things but when I get back to the Arduino projects I will give it another go.

Β 


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
Topic starter  

@robotbuilder

Posted by: @robotbuilder

@frogandtoadΒ 

Thank you for your patient reply.Β  At the moment I am working on other things but when I get back to the Arduino projects I will give it another go.

Β 

Not a problem!

I know you enjoyed working with BASIC, so hopefully you find some use in this IDE (one of the few different options available).

Cheers


   
Inst-Tech reacted
ReplyQuote