Introduction: Getting Started With GR Peach | Button

Picture of Getting Started With GR Peach | Button

GR-PEACH from Renesas is an mbed enabled platform which combines the advantages of the mbed ecosystem and Arduino form factor. The RZ/A1H includes an ARM® Cortex™-A9 processor along with the integrated peripheral functions required to configure a system.

The RZ/A1H includes a 32-KB L1 instruction cache, a 32-KB L1 data cache, and a 128-KB L2 cache. This LSI also includes on-chip peripheral functions necessary for system configuration, such as a 10-MB large-capacity RAM, 128 KB data-retention RAM(shared by the large-capacity RAM), various timer function, real-time clock, serial communication interface(UART), I2C bus interface and graphics related functions.

Features

  • Renesas RZ/A1H
    • High performance ARM® Cortex™-A9 Core
      • including NEON and FPU400MHz
    • 400MHz, 10MB On-Chip RAM
    • 32KB Instruction cache, 32 KB Data cache and 128KB L2 cache
    • 2xUSB Host/Device Interface, 1xEthernet
    • 5xSPI, 4xI2C, 8xUART, 8x12-bits ADC, 5xCAN, 2xLCDC, 2xCamera Input
    • 2xSD, 2xMMC, GPIO
  • GR-PEACH
    • 8MB FLASH
    • 2xUSB Host/Device Interface, 1xEthernet
    • 5xSPI, 3xI2C, 8xUART, 7x12-bits ADC, 2xCAN
    • 2xCamera Input
    • To be supported
      • 1xLCDC(via LVDS)
  • Arduino form-factor
    • Compatible with a wide range of commercially available shields
    • Built-in USB drag 'n' drop FLASH programmer
  • mbed.org Developer Website
    • Online Compiler
    • High level C/C++ SDK
    • Active developer community

Note: In order to follow this Instructable, you should already be familiar with GR Peach Online Compiler and should know how to upload the code. If you are unclear of the above listed concepts, please follow my other instructable - Getting Started with GR Peach | LED Blink.

Step 1: A Little About GR Peach Board

Picture of A Little About GR Peach Board

In this Instructable, the button interfaced, is the USER_BUTTON0 (marked in GR Peach Schematic and Pin Diagram). This button is connected to PIN P6_0 and the pin is PULLED UP. This means, when the button is not pressed, the P6_0 is 1 (or HIGH) and when the button is pressed, the P6_0 is 0 (or LOW).

Step 2: Button Code

Picture of Button Code

Login to your mbed account and open the Online Compiler. Open a New Program with template - Blinky LED Hello World and rename project name to mbed_switch. Now double click on "Main.cpp" to open the main program script. Click on Compile and this should automatically download a Binary (.bin) file.

Button Interfacing Code -

#include "mbed.h"

DigitalOut myled(LED1);

DigitalIn Switch(P6_0);

int main() {

while(1) {

if(Switch == 0) {

myled = 1;

}

else {

myled = 0;

}

}

}

Code Components -

#include "mbed.h" - This imports the library (all functions) for the mbed platform.

DigitalOut myled(LED1); - Sets LED1 (RED- Onboard) to OUTPUT and myled points to LED1.

DigitalIn Switch(P6_0); - Sets P6_0 (USER_BUTTON0) to INPUT and Switch points to USER_BUTTON0.

myled = 1; - Sets myled status to HIGH.

myled = 0; - Sets myled status to LOW.

if(Switch == 0) - Checks whether Switch is Pressed or Not and accordingly executes the statement block.

Step 3: Uploading the Code to GR Peach

Now its time to Run the Code. Connect your GR Peach to your PC, copy the Binary File to the MBED drive. Then reset the GR Peach by pressing the RESET button, this would execute the code. If all goes well, you should see RED LED light up when you press the button and go off when you release it.

Comments

About This Instructable

313views

6favorites

License:

Bio: Inventor. Developer. Engineer. Born to Tinker. Live to Ride.
More by EvilMonkeyTech:Arduino Based Windows PC Volume Remote ControlGetting Started with GR Peach | ButtonGetting Started with GR Peach | LED Blink
Add instructable to: