Let's Make a Gadget with the GR-SAKURA Board!

For easy creation of simple gadgets, the Gadget Renesas project provides the GR-SAKURA board for use with a web compiler. The board comes with a microcontroller (MCU) that operates as a mini computer. By programming this MCU, you can make things flash in various colors, produce sounds and melodies, and move objects.

Sketch Reference

This reference describes libraries for writing programs for GR-SAKURA and HTTP API for controlling the web compiler. Refer to the information below when using the GR-SAKURA board for the first time.

Note: This reference is for the library version v2.00 or higher.

Arduino Sketches

The GR-SAKURA board and Arduino are fully compatible. Most of the pin layout is the same and the libraries are used in almost the same manner. The only key difference is, in Arduino, programs are called "sketches". For simplicity, we call a program a "sketch" for GR-SAKURA as well.

Here's a little explanation about sketches. This is a simple sketch that makes one LED on the GR-SAKURA board flash.

#include <Arduino.h>
void setup(){
    pinMode(PIN_LED0, OUTPUT);
void loop(){
    digitalWrite(PIN_LED0, HIGH);
    digitalWrite(PIN_LED0, LOW);

Arduino requires a unique description -- setup() and loop() -- to be included in the description.

The setup() function is called only once after start up. The sketch above is preparing to turn on an LED using the pinMode() library.

The loop() function is then executed repeatedly. The sketch uses the digitalWrite() and delay() libraries to make an LED flash.

Whenever creating a sketch for the GR-SAKURA board, always describe #include <Arduino.h> in the first line.

The best thing about ABC Arduino is its extensive number of libraries. These libraries allow you to do just about anything quite easily, from making LEDs flash, to creating sounds, running motors, and connecting to a network. Check out the contents of each library by selecting LIBRARY in the above menu.

About the Pin Layout

The image below describes the pin layout for the GR-SAKURA board. There are many cases where you will use the library with a pin number.


For example, the following description sets pin2 to LOW:

digitalWrite(2, LOW);

And, the following description reads from the A0 condition:



You can easily create gadgets using the GR-SAKURA libraries. You can make LEDs flash and buzzers buzz, save data in the EEPROM, run a motor, and communicate using USB or Ethernet.

Basic Library

This is basic output of the digital signal, calculation and interrupt. You can use the basic library without additional description, #include and instance generation. For example, the following description:

#include <Arduino.h>
void setup() 
void loop(){

Standard Library

This is for applied operation, motor control, SPI communication, and memory operation etc. You can use it with additional description. For example, the following description for a servo motor.

#include <Arduino.h>
#include <servo.h> 
Servo servo0;
void setup() 
  servo0.write(90);  // set servo to mid-point
void loop(){

This means to attach a servo motor to pin9 and set the angle to 90. Additional description is #include <servo.h> and Servo servo0 that is a generation of instance. Refer to each library page for use.

Web Compiler Control API

This API enables the user to control a project from the web compiler using HTTP communications. For example, easily create a program for a smartphone application.

The general flow in using the API is as follows: Get the project or file information in the web compiler, rewrite the specified file, then download the results of the build.

An API key is required to execute this API.

Open the settings page for details concerning the API key.

An error (null value) is returned if an API is executed while another API is already in progress.


Feel free to go to the Renesas Engineering Community with questions, problems or comments. Other users, both veterans and newbies, are there to help!