Skip to main content

KAEDE Sketch Reference

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

The Gadget Renesas Project provides the GR-KAEDE board for use with a Web compiler, for easy creation of simple gadgets. The board comes with a microcontroller (MCU). 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 the GR-KAEDE board and HTTP API for controlling the web compiler. Refer to the information below when using the GR-KAEDE board for the first time.

Arduino Sketches

The GR-KAEDE 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 KAEDE as well.

Let us explain a little about how sketches work. The simple sketch shown below makes one LED on the GR-KAEDE board flash.


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

One unique characteristic about Arduino is that setup() and loop() must be written 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 above uses the digitalWrite() and delay() libraries to make an LED flash.

When creating a sketch for the KAEDE 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 from the menu above.

About the Pin Layout

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

gr-kaede-pin-map

For example, the following description means to set pin2 to LOW.


        digitalWrite(2, LOW);
        

The following description means to read from the A0 condition.


        analogRead(A0);
        

Libraries

Using the KAEDE libraries will help you create cool gadgets with ease. 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, interrupt. You can use the basic library without additional description, #include and instance generation. For example:


        #include <Arduino.h>
        void setup() 
        {
            Serial.begin(9600);
            Serial.println("Hello");
        }
        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.attach(9);
            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.

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!