Let's Make a Gadget with the GR-LYCHEE Board!
For easy creation of simple gadgets, the Gadget Renesas project provides the GR-LYCHEE 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-LYCHEE and HTTP API for controlling the web compiler. Refer to the information below when using the GR-LYCHEE board for the first time. In cases where the Mbed compiler is used, refer to the Mbed.com page for GR-LYCHEE.
Arduino Sketches
The GR-LYCHEE board and Arduino are almost 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-LYCHEE as well.
Here's a little explanation about sketches. Take a look at the sample sketch below. This is a simple sketch that makes one LED on the GR-LYCHEE board flash.
#include <Arduino.h>
void setup(){
pinMode(PIN_LED_RED, OUTPUT);
}
void loop(){
digitalWrite(PIN_LED_RED, HIGH);
delay(200);
digitalWrite(PIN_LED_RED, LOW);
delay(200);
}
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-LYCHEE 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-LYCHEE 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:
analogRead(A0);
Basic Library
Digital I/O
Analog I/O
Advanced I/O
Time
Math
Trigonometry
Random Numbers
Bits and Bytes
Interrupts
Serial Comm.
Standard Library
Camera
Servo Motor
Stepping Motor
Character LCD
SPI
I2C (Wire)
SD Card
SD (File Operations)
Periodic Operation
Clock (RTC)
Mbed Tips
Libraries
You can easily create gadgets using the GR-LYCHEE libraries. You can make LEDs flash and buzzers buzz, save data on an SD card, run a motor, and communicate using USB, Wi-Fi and Bluetooth.
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()
{
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!