Ready for a bit of “Gadget” fun?!

Let’s have a bit of fun creating unique gadgets with the COTTON board and Web compiler provided by the Gadget Renesas Project. The COTTON board comes mounted with a very small microcontroller (MCU). That’s the flat black thing stuck to the middle of the board. By programming this little guy, you can make lights flash, emit various noises, and trigger objects to move!

Sketch Reference:

This reference describes libraries for writing program for GR-COTTON, and HTTP API for controling web compiler. Refer to the below when you start to use GR-COTTON at the first time.

About "Arduino-like" sketches...

The COTTON board is compatible with Arduino. The library is 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 to the below. This is a simple sketch that turns on red LED on the COTTON board.

#include <Arduino.h>
void setup(){
    pinMode(22, OUTPUT);

void loop(){
    digitalWrite(22, HIGH);
    digitalWrite(22, LOW);

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 the using 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 COTTON 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 in the menu above.

About Pin layout

Below describes pin layout of the COTTON board. There are many cases you use the library with 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 analog value. For example, the folllowing description:


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


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

Made by Gadget Renesas Project
Contents are CC BY-SA 3.0