Overview
This project introduces how to make a sketch using IDE for GR, a program tool based on the Arduino IDE. It is available on Windows and Mac. Once you download IDE for GR, you can sketch off-line.
Preparation
Hardware
Prepare a GR-SAKURA board and a USB cable (Mini B type)
Software
Download IDE for GR. If using Windows, decompress the zip file. If using Mac, open the DMG file and register it as an application. IDE4GR will be added to Finder as an application.
Procedure
1. Start IDE for GR
For Windows, execute "ide4gr.exe" in the decompressed folder.
For Mac, execute IDE4GR from applications in finder.
You will then see the IDE GUI screen shown here.
2. Select a Board
Select GR-SAKURA from menu [Tools] -> [Board] as shown in the image.
3. When Using for the First Time
Load the sample "Fading" from menu [File] -> [Examples] -> [03.Analog] as shown in the image.
Then, modify your sketch in the part "ledPin" to "PIN_LED0". For other pin definitions, refer to the GR-SAKURA Sketch Reference.
4. Connect GR-SAKURA and Prepare to Flash
Connect GR-SAKURA to a PC with a USB cable and then push the Reset button on GR-SAKURA. GR-SAKURA will be displayed as a USB storage
5. Build and Upload Your Sketch
Click the RIGHT arrow button, then the IDE will compile your sketch and upload it to GR-SAKURA.
Now, the LED on GR-SAKURA should be fading.
Using a Serial Monitor
You can communicate with GR-SAKURA by serial monitor. Please try the following.
Copy and upload the following sample in your sketch.
#include <arduino.h>
void setup() {
Serial.begin(9600);
}
void loop() {
static int oldtime = 0;
if((millis() - oldtime) > 1000){
Serial.println("Hello World");
oldtime = millis();
}
if(Serial.available()){
if(Serial.read() == 'a'){
Serial.println("Hi, I'm SAKURA!");
}
}
}
Select the Port
After uploading the sketch above, select the port from menu [Tools] -> [Serial Port] as shown in the image. Note that your PC recognizes the port after executing "Serial.begin".
Display Serial Monitor
Click the button as shown in the image.
You will see the serial monitor displaying "Hello World". Click send after inputting 'a', as shown in this image.
GR-SAKURA will reply to you, as shown here.