Skip to main content

GR-CITRUS Special Project: Sketch with Web Compiler

Overview

This article describes how to create an Arduino sketch (program) using the GR-CITRUS board. The main tool used to create sketches, Renesas Web compiler, is compatible with Windows and Mac.


Preparation

You will need a GR-CITRUS board and a USB cable (micro B type).

citrus-sp-rubic-restart
usb-cable

Protocol

1. Login to the Web Compiler

Login to the Web compiler from the GADGET RENESAS top page.
Click the link shown in the image to the right to open the top page in a new tab.

gr-sp-login

Enter your MyRenesas account information and press the Sign In button.

my-renesas-login

2. Create a Project

Use the buttons shown below to create a new project. Skip this step if this is the first time you are logging in.

gr-sp-create-project

As shown in the following window, select GR-CITRUS_Sketch_xxx.zip (xxx indicates the version), assign any project name you like, and press the Create Project button.

citrus-sp-create-prj

3. Sketch Display

The Create Program window is displayed as follows. Double-click gr_sketch.cpp in the Explorer navigation bar on the left side of the window to display your program.

What you see displayed is the sketch (program) that will run GR-CITRUS.

peach-sp-sketch-display

4. Build the Sketch (Compile the Program and Create a Write File)

This window is where you will write programs. A sample program has already been completed for you that turns on the LED located on the GR-CITRUS board.

First click the Execute Build button in the right navigation section. The build is successful when the following message is displayed: “The compile was successful.”

Note: The first build after creating a project takes a little longer than normal, because all of the files are being compiled.

citrus-sp-build-sketch

The results of the build are displayed as follows. If the build is successful, the following message is displayed: Make process completed. Click the Close button to close the window.

citrus-sp-build-result

5. Download the Sketch (Save the File to be Written to the Computer)

When the build is successful, a citrus_sketch.bin file is created. Right-click on this file name to open the pull-down menu. Select Download to download the file to your computer.

citrus-sp-download-sketch

6. Connect GR-CITRUS and Computer with USB Cable

Next, connect the GR-CITRUS board to your computer with the USB cable. After connecting the two, press the Reset button. The GR-CITRUS board will be recognized as a USB memory.

citrus-sp-connect

7. Write and Run the Sketch

Copy and paste the citrus_sketch.bin file you downloaded to your computer. After the sketch is written, the LED will turn on.

citrus-sp-sketch-read-write


Make the Sample LED Flash Like a Firefly!

The following sample makes the GR-CITRUS LED flash softly like a firefly. Copy the sketch to the Web compiler and give it a try!

    
    #include <arduino.h>
    
    void setup(){
    }
        
    void loop(){
            
        for(int i = 0; i < 256; i++){
            analogWrite(PIN_LED0, i);
            delay(5);
        }
            
        for(int i = 0; i < 256; i++){
            analogWrite(PIN_LED0, 255 - i);
            delay(5);
        }
    }