programar-digispark-con-el-ide-de-arduino

Programming Digispark with Arduino IDE

  • 2 min

After a few posts dedicated to Digispark, let’s see how to program this small development board with the Arduino IDE.

Fortunately, Digispark boards can be integrated into the board manager, so their installation is quite straightforward.

The only problem we might encounter is that the computer does not recognize the drivers (especially on Windows 10). But well, it’s something we’re already used to.

Installing Digispark in the Arduino IDE

To add Digispark to the Arduino board manager, first, we access the IDE configuration menu. Here, where it says “Additional Boards Manager URLs” (which, by the way, is hard to have translated worse), we click on the small button on the right.

programar-digispark-arduino-ide-configuracion

In the window that appears, we add the following address.

digistump.com/package_digistump_index.json

If we had other boards previously, we would add each one on a separate line.

programar-digispark-arduino-ide-url

We restart the Arduino IDE. We launch it again, and now we can access the board manager.

programar-digispark-arduino-ide-elegir-placa

Here, we select and install Digistump AVR boards by Digistump. The Arduino IDE will perform the board installation and install the necessary drivers.

programar-digispark-arduino-ide-gestor-tarjetas

As an additional precaution on Windows, and to avoid driver problems, I recommend launching the installation manually.

To do this, we go to the path where the IDE has installed the Digispark files, located in the following route (replacing, logically, USER with your username).

C:\Users\USER\AppData\Local\arduino15\packages\digistump\tools\micronucleus\2.0a4

Finally, we run the file “Install Digistump Drivers.bat” as Administrator, and cross our fingers for everything to go well.

programar-digispark-arduino-ide-drivers

Hello World on Digispark

To check that everything has gone correctly, let’s load our first file onto the Digispark. As always, we’ll use Blink as “Hello World”.

In the IDE environment, we open a new file and paste the following code, which simply blinks the integrated LED.

const int ledPin = 1;

void setup()
{
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}
Copied!

In the board type, we choose Digispark (Default - 16.5 Mhz).

programar-digispark-arduino-ide-default

Here comes an important difference compared to conventional Arduino models. We must start the upload with the Digispark disconnected. Therefore, we do not choose the COM port.

We click on upload. After compilation, the Arduino environment informs us that we have 60 seconds to plug in the board.

programar-digispark-arduino-ide-subir

We connect the Digispark and, if everything has gone correctly, we will see that the upload finishes and the board’s LED starts blinking.

Success! To continue playing, when installing the Digispark board, many examples are added to experiment with this board. I recommend you take a look at them. Let’s play!