Your First Sketch – Embeetle IDE

So you have finally decided to give the Embeetle IDE a try, I mean, why not, you have nothing to loose right ? After starting the IDE, you get to this screen…

The Embeetle IDE Home Screen

You are presented with many different options, but which one should you choose… Many of you will choose “Create Empty”, but be warned: This is not what you want. For those of us that come from standard IDE software, especially the Arduino IDE, we believe that the source files should only contain void setup() and void loop()… and then we can continue with our coding …

This is however very very wrong… Many IDE’s hide most of the code from you, in an effort to make it “easier to use”. Embeetle does not do that. So unless you are very confident in your C/C++ skills, Do not choose this option.

Embeetle requires you to use real C++ when you write code, so while you can still do all the things you are used to do with “Arduino C” there will definitely be a few differences that you need to take account of. Professional developers will not have a problem however, as you are already used to declaring function prototypes etc…

So where do we start then?

Select the “Download Sample Project from Embeetle Server” option.

After a few seconds, you will be presented with this screen:

Now, we have to mention another point about Embeetle. Embeetle does not only support Arduino Boards. Embeetle supports many other devices, and the list is growing.. so you will have to choose your device… So as an example, I will show you how to load the standard “blink” sketch on the Arduino Uno R3 ..

After selecting a Vendor and a Board, and some scrolling, I have selected the Arduino Uno R3 Blinky sketch.
Go ahead and click on the “Create” button. Embeetle will now generate your sketch, generate a makefile and all the other needed files that are normally hidden away from you, and then open the editor window…

An important note here:

When you have installed Embeetle for the first time, you may not have all the required toolchains and other drivers installed on your computer. Usually, this can be a real pain to figure out. But, once again, Embeetle will take care of it… with a little bit of your help, of course… You may be presented with a small window, asking you to choose toolchain and or linker applications. Click on the drop-down menu, and select the option in GREEN. nothing else, and click apply… Embeetle will automatically download and install it, no further actions required from you!~ Easy, is it not ?

The Embeetle Editor

So now, the Editor has opened, and you are all confused, as it does not look anything like what you are used to, so what do we do now ? Lets look around the IDE quickly…

At the top left, we have a menu bar, and below that, a few tool buttons, not many, as we dont need all of those cluttered buttons anyway…
The most important here is :
The Broom : Cleans your project
The Hammer: Builds ( compiles ) your project
The Chip : Flashes the project onto the device
The Serial Port: Opens the Serial Monitor

In the center column, we have the File tree, showing all the files your project are using, with green dots in front, meaning in use, and red meaning not used,

and directly below that, the Dashboard…

This is where you will select your tools, as well as the serial port your device is connected to…

On the Far right, you have a symbol table, and some diagnostics ( but this is usually for the more advanced users, although everyone can benefit from using how to use these

Connecting your Device

Let us connect our device.
1.) Start by plugging you Arduino Uno R3 into the USB Cable, and connecting the cable to your computer.
2.)In the Dashboard window, Click on Probe -> Com-Port -> Select and choose your port ( on Ubuntu, it wil be /dev/ttyUSB0 or similar, on Windows it may be com3 or similar

After selecting your device communications port

3.) A red warning will now appear, “APPLY DASHBOARD CHANGES”. Click on this to confirm your changes.
4.) your device are now connected, and you can start coding…

Let us have a quick look at the coding style, as is is quite different from what you would use in an the Arduino IDE

The most important change is that you will need to declare function “prototypes” This is normal in standard C/C++ but is not needed in the Arduino IDE…

this means doing this:

void setup();
void loop();

You will have to declare any other functions that you write on your own as well… including their datatypes, and any parameters that they require… Once again, this is usually not a problem for the casual home user, and the professional developers already know what this means…

The complete sketch is below

/*
  IMPORTANT NOTE FOR ARDUINO USERS
  ================================

  The language used in Arduino sketches is a subset of C/C++.
  However, in Embeetle you should use plain C/C++, which means
  that:

    - Functions should have a function prototype, usually
      declared at the top of the file.

    - Include statements are important to use functions,
      variables and classes from other files.

*/

#include <Arduino.h>

/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/Blink
*/

// the setup function runs once when you press reset or power the board

void setup();

void loop();

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, 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
}

Now, let us build and flash the code to the device

Click on the hammer tool... 

Embeetle will compile and build your code, and inform you at the bottom of the console if all went well. If it did, click on the Chip Tool to Flash it to your device

Once again, Embeetle will inform you of the status of the Upload, and if you did everything correctly, the led on the UNO will start flashing….

In our next article, we will look at how to use the Library manager. This is definitely one of the most powerful features of Embeetle, only to be surpassed by the source analyser and the symbol generator.. but more on that later.

Thank you

Arduino Support for the Pi Pico …

Official Arduino IDE support for the Raspberry Pi Pico is finally here. It took a while,and those of us that could not be bothered with Micro-Python, or complex C tool-chains, can finally take out Pico’s out of the drawer, and start putting them through their paces…

This is also an excellent opportunity to really push the Maker Pi Pico, from Cytron Technologies, so its limits, as the rich library environment from the Arduino IDE, will definitely allow quick and fast access to all of the Maker Pi Pico’s built in hardware…



Adding Pico Support to the Arduino IDE

Before we can use the Pico with the Arduino IDE, we first have to add support for the board into the Arduino IDE.
This is done with the Boards Manager, Although very easy, there are however a few things that you have to take note of. You have to remove support for ALL other Pi Pico boads packages that you may have installed into the Arduino IDE, previously, as well as any additional board url’s in the preferences menu…

Then, after removing that all, restart your Arduino IDE, go to the Tools menu, and then Boards _> Boards Manager.
Type Pico into the search box. Press Enter…

Select and Install the “Arduino MBed OS RP2040 Boards”…
Wait for this to install, It will take a while, depending on your internet speed…

When this is finished, we can configure your Pico board.

Please Note:
On Linux operating systems, like Ubuntu, you will have to perform an additional step. This is because of permissions on hardware devices. You will have to start the Arduino IDE as a superuser, i.e. with sudo, from the command line, and then install the RP2040 support AS WELL…. Once that is done, keep the IDE open, and continue with the rest of this guide….

To do this do the following:

Open a Terminal Window
go to the Arduino installation folder, on my system ( Ubuntu 20.04 LTS it is /home/jean/Downloads/arduino-1.8.13 )
and then issue the command $ sudo ./arduino

You will get a similar display as above …
Now open the boards manager again, and install the “Arduino MBed OS RP2040 Boards” board support files ….

Continue to the next step below…

Uploading your first sketch to the Pico

DO NOT PLUG THE PICO INTO A USB PORT YET

With the Arduino IDE Open, ( As superuser on Ubuntu or other Linux), open a blank sketch, and select the Raspberry Pi Pico, from the Boards menu under Tools ( It will be under Arduino MBed OS RP2040)

Open a blank sketch, or the standard blink example sketch.

Now, while holding the BOOTSEL button on the PICO pressed in, plug in your PICO, and then release the button.
The Pico will open a File Dialog on your computer, similar to when you loaded Micro-Python Support.
Do NOT search for a Com port at this stage, it will not exist yet !

Ignore the File window, and click on the upload button in the Arduino IDE.
The sketch will upload, and the PICO will reset automatically.

UBUNTU or other Linux Users, If this was successful, you can close the Arduino IDE as superuser, and open your standard Arduino IDE.

After this step, you will not have to hold down BOOTSEL every time to upload a sketch, even if you have unplugged the PICO, but you will have to select a valid COM port in the Arduino IDE… On Ubuntu, it will be /dev/ttyACM0 or similar, please look in the ports menu under tools in the Arduino IDE.

You can now make use of all the existing Arduino libraries with your Raspberry Pi Pico…

A few points to note:

I2C is on GP6 (SCL) and GP7 (SDA) -> confirmed as definitely working ( i2c1, not i2c0 !)
SPI is as mentioned in this post -> GitHUB ( Please note that there seem to still be a bit of teething problems, your mileage may vary )