Sketch Reference
This reference describes libraries for writing programs for the GR-ROSE board and HTTP API for controlling the web compiler. Refer to the information below when using the GR-ROSE board for the first time. If using the Mbed compiler, refer to the Mbed site.
Arduino Sketches
The GR-ROSE board enables users to sketch like Arduino. The only key difference is, in Arduino, programs are called "sketches". For simplicity, we call a program a "sketch" for GR-ROSE as well.
Here's a little explanation about sketches. This is a simple sketch that makes one LED on the GR-ROSE board flash.
#include <Arduino.h>
void setup(){
pinMode(PIN_LED1, OUTPUT);
}
void loop(){
digitalWrite(PIN_LED1, HIGH);
delay(200);
digitalWrite(PIN_LED1, 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 uses the digitalWrite() and delay() libraries to make an LED flash.
Whenever creating a sketch for the GR-ROSE 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-ROSE 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
Ethernet
Servo Motor
Stepping Motor
Character LCD
SPI
I2C (Wire)
SD Card
SD (File Operations)
Periodic Operation
Clock (RTC)
PPG (Pulse Generator)
WiFiEsp
ICS (Serial Servo)
FreeRTOS Tips
Libraries
You can easily create gadgets using the GR-ROSE 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!