Ready for a bit of “Gadget” fun?!

Let’s have a bit of fun creating unique gadgets with the GR-KURUMI board and web compiler provided by the Gadget Renesas project. The board comes mounted with a very small microcontroller (MCU). By programming this IC, you can make lights flash, emit various noises and trigger objects to move.

Sketch Reference

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

About "Arduino-like" Sketches

The GR-KURUMI board is compatible with Arduino. The pin layout and outline are nearly the same as Arduino Pro Mini, the small one. And the library is also nearly the same.

In Arduino, programs are called "sketches," which is why we have tried to make things easier by calling them "sketches" here as well.

Here's a little explanation about sketches. Take a look at the sample sketch below. This is a simple sketch that turns on a red LED on the GR-KURUMI board.


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

Arduino requires a unique description -- setup() and loop() -- to be included in the sketch. The setup() function is called only once after reset or power-on. Then, the loop() function is executed repeatedly. For example, the sketch to the right turns the LED on and off using the pinMode(), digitalWrite() and delay() functions. The pinMode() in the setup() defines which pin to use for driving the LED. Then, the digitalWrite() turns the LED on and off. The delay() defines on and off time. When using the KURUMI board, always describe #include <RLduino78.h>, the library that includes all these Arduino compatible functions, in the first line.

The best thing about Arduino is its plentiful choice of libraries. These libraries make it easy to not only turn on LEDs, but also emit noises, run motors and connect to networks. Check out the lineup in the Library tab from the menu above.

About the Pin Layout

The image below describes the pin layout for the GR-KURUMI board. There are many cases where you will use the library with a pin number. For example, the following description:


digitalWrite(2, LOW);

This means to set pin2 to LOW. And, from A0 to A7 can be used to read the analog value. For example, the following description:


analogRead(A0);

This means to read from the A0 condition. From A0 to A7 are same as from 14 to 21. And, pin22 is connected to the red LED on the GR-KURUMI board, pin23 is the green LED and pin24 is the blue.

gr-kurumi-pin-map

Update

March 30, 2018: Updated Serial and Ethernet. Added SoftwareSerial.

Libraries

You can create a gadget easy with the libraries. Most of the functions that you want to use are here, such as ADC, Timer, PWM, sound generation, SPI communication, USB virtual COM port, USB host, real-time clock, memory card, and Ethernet.

Note: The library for GR-KURUMI is different from GR-SAKURA in that the library for GR-KURUMI is included in the template of the project.

Basic Library

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


        #include <Arduino.h>
        void setup() 
        { 
          Serial.begin(9600);
          Serial.println("Hello");
        }
        

The above code can be described in the setup and loop function without additional code.

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.attach(9);
          servo0.write(90);  // set servo to mid-point
        }
        

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.

Support

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