Beginner, Coding for Arduboy alone, or side by side with C++?


#1

As a beginner,
Would you recommend me to just focus on coding on Arduboy, or do it side by side with C++ programs and tutorials?

Also, would you use programs used for coding C++ (Visual Studio, netbeans, QT, Code::Blocks,…) to code lines for Arduboy, and just copy/paste the code in an arduboy specific program to upload it,
Or would you recommend doing everything in the programs recommended for Arduboy (using no other code editors)?

Thanks!


(Agent6) #2

I would start by following this Make Your Own Arduboy Game: Part 1 - Setting Up Your Computer

They have put together some good lessons that is focused on the Arduboy.


(Scott) #3

It’s also helpful to refer the the Arduino Language Reference when programming for the Arduboy and other Arduino devices.


(Scott) #4

Personally, I do all Arduboy programming, compiling and uploading using the Arduino IDE.

However, if I have a lot of coding or editing to do, I’ll use the gedit text editor under Ubuntu Linux.

In the Arduino IDE, you can select File -> Preferences and then set Use external editor. The code in the IDE will then be greyed out as read only. Then, changes made (and saved) using any external editor will automatically appear in the IDE when you switch to it.


(Pharap) #5

I’d say it might be helpful to learn C++ for standard/desktop programs alongside Arduboy.

But don’t expect to be doing graphics programming.
C++ always starts with command line programs.

(I particularly like this C++ tutorial because it covers a lot of nice C++11 features: https://www.learncpp.com/)

What you’ll be able to copy and paste from desktop code to Arduboy code will depend on how it’s written.

For that to work you’d have to make sure the code doesn’t depend on unavailable parts of the C++ stdlib, such as std::cin and std::cout.

And you’ll have to be careful about what types you’re using.
Remember that the fundamental types differ in size depending on platform.
So best stick with the fixed-width types (uint8_t, uint16_t).

You’ll also have to be careful of how namespaces are qualified.
You may wish to put using std::uint8_t, using std::uint16_t etc near the top of your desktop code.

I’d say try to only use the desktop code for learning and experimenting though.
It’s useful because desktop is faster to compile and run than uploading to Arduboy,
but you have to be careful about how you translate the code between the different environments.

The important thing is that you understand how the language works.
Copying and pasting code is (generally speaking) pointless unless you actually understand how the code works and how it might break.

But when it does break, it should be a good learning opportunity.
Read the error message and pick the code apart until you understand why it broke.


Regarding editors:
For desktop C++ I use Visual Studio.
For Arduboy and Arduino I used to use the Arduino IDE,
but I’ve now migrated to Visual Studio Code.

I’ve never used QT, but I’ve used Code::Blocks and NetBeans and they’re not bad as such but I much prefer Visual Studio.


#6

Thanks for your input Pharap, I am actually in the process of learning from that site.
I like learning, but if there are too many differences, that would confuse me as a beginner, it would make more sense just studying Arduboy code; that’s why the question.

Though it appears to me that learning C++ from that site, will help me understand the arduboy tutorials better!

As far as using other code editors, I was more referring to,the emulator I use, doesn’t have a very good coding editor.
Some of the editing programs (Visual Studio, QT, … ) look much nicer than the emulator.
I’d only use it to write code, not to compile it.
It’s easy nowadays to run 2 programs (one to write, another to compile and upload to Arduboy).
Systems have enough ram and CPU to run both.

I try not to waste too much time uploading stuff to the Arduboy yet.
Sure, now and then it’s nice to see my program work on the actual device, but I mainly focus on the emulator right now.
Once more complex programs pass the compiler, and run fine on the emulator, I’d upload them to the Arduboy. But I think most simple programs and tutorials I do, will work on the Arduboy just like they do on the emulator.