This blog describes the basics on how to use the Arduino with the installable Arduino IDE application. This is the program you need to write code for the Arduino and then upload it on the hardware. Following are three examples on what you can do with the Arduino.

  1. Set up LEDs on a breadboard anc control them with the Arduino.
  2. A short introduction to the GROVE platform that allows you to connect various sensors and actuators to the Arduino by simply plugging connectors to an interface board. This section also gives you links to look for sample projects and code snippets.
  3. A project using NEOPIXELs, controlled by the Arduino.

The following image shows a traffic light arrangement of LEDs. The three LEDs are connected to the Ports 2, 3 and 4. The minus cable from the breadboard gets connected to the GND port of the Arduino.

Arduino with breadboard, a traffic light with LEDs

The wiring scheme on photo.


Here is the code doing some on and off with the LEDs.


Using the Arduino with the Grove platform



The Grove platform consists out of a shield with 4 pin connectors that allow to easily connect sensors and activators to the Arduino board. The shield is stacked on top of the Arduino board. There are

  1. 4 Analog inputs or outputs, labeled A0 to A3
  2. 7 Digital inputs or outputs, labeled D2 to D8
  3. 1 UART interface for serial communication
  4. 4 I2C communication ports, that’s a serial bus, labeled I2C. This bus is used for devices as the Ultrasoundsensor, LCD display and other sensors or activators that send or receive more complex data than what can be handled with the analog and digital ports. Each of the I2C device gets a hardware or software assigned ID so that your code can address each device individually and make it do the things it can do.

Each 4 pin connector has GND (or minus, OV), VCC (this is 3.3V or 5V depending on the switch setting beside the reset button/green power LED) and two data pins, they are different for each connector. When you are using the Grove cables,

  1. red is 3.3V/5V or VCC
  2. black is GND or 0V
  3. white is a data wire, look at the Grove shield
  4. yellow is the other data wire, look at the Grove shield

Project Ideas

Here is a link to the manufacturer of the Grove system, Seeedstudio. The Project One to Project Eight are good ways to create small projects.


Here is a photo with some of the Grove sensors and activators available.


For Project Six, you can also use the “Grove LCD RGB Backlit”. You can find more information including wiring and sample code here. Please also use the code sample shown here as the function calls may be different to those in Project Six.

External libraries for the Arduino IDE (required for the following project with the Neopixels)

For some sensors and activators you need to download external libraries. These contain functions that make it easier for you to use the devices. With the Arduino Version 1.8.9 you can download them easily by selecting “Tools” in the menu and then “Library Manager”.


The photo above shows the library you need to download to run the Grove LCD RGB Backlit module.

The Grove website shown above has a good document for all sensors and activator boards. So check there for more information and in particular sample code that you can then remix to your liking.

Arduino With Neopixel

Here you find a tutorial on how to connect a chain of Neopixels to the Arduino, which library to download and some sample code.

Setup the Hardware

The Neopixel requires more power than the Arduino can handle if all LEDs are on and will destroy it. Therefore you need to beef up the power supply and run the Neopixels with 3 x 1.5V batteries. Have a look again at the first lesson we had and ask for help, here is also a photo of the full hardware setup for your reference.


The red and white cable coming from the Grove shield remain unconnected, the black is 0V and connects to the OV or Minus of the battery pack and the black cable coming from the Grove shield. A red cable with crocodile clamps connects the Plus (+) of the battery pack with the red cable from the Neopixels.

If that’s too much of a hazzle for you, just use the stripe with 5 Neopixels, you can easily fix it on the breadboard, it does not require any additional power. Connect matching cable colours to the Grove interconnection cable, red to red, black to black and yellow to yellow. Then download the library and follow the instructions below. You will need to initialise the Neopixel for 5 Pixels only.


Once you have the Neopixels and the PC connected to the Arduino, open up the Arduino IDE, download the Adafruit Neopixel library. It also contains sample projects to start with. Have a look in the Menu under File/Example/Adafruit Neopixel. A good starting point is the sketch “simple”. You need to change two values in this program.

  1. The numerical value for the constant PIN needs to match the port number you have chosen. On the photo it is D4, so you enter the number 4.
  2. Next you have to tell the program how many Neopixel your stripe has. The long one has 32, so change the value of the constant NUMPIXELS to 32.

The program is well documented, so just read and do the two changes where it is highlighted.

Here is the complete sample code, reduced to the parts you really need and their comments, all changes have been done already.

190514 neopixelSample.jpg

When you experiment with the code, the following hints may be helpful:

  1. random(min, max) is a function that returns a random integer number between min and max-1. If you declare random(0, 128) the function will return a value between 0 and 127. You may use it to choose a random colour.
  2. In the programming language C you need to declare the type of a variable before using it. int jvariable is declaring the variable with name jvariable as of type integer, so it can contain whole numbers.
  3. Otherwise loops (for …, while …) and conditionals (if else …) and the highlighting of blocks with curly brackets ( {}  ) is similiar to Javascript.