• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeStarter Kit for pcDuino8 Uno User Guide3.C Language and Arduino type IDE for pcDuino8 Uno3.3.Arduino IDE
Previous Next

3.3.Arduino IDE

Posted by: Olva , August 10, 2016

pcDuino8 Uno Ubuntu 14.04 sytem Image 20160102 has Arduino IDE built-in.

We added a new board type ‘pcDuino’. By default, the board type is pcDuino.

This part will tell how to program GPIO using Arduino IDE.

Steps(Arduino IDE)

1. Open Arduino IDE

Click start menu and open Programming –> Arduino IDE.

2. Compile and run the example code

When you open the Arduino IDE, you can find a new board type ‘pcDuino’.

Take a blink sketch as example. From Menu bar: File –> Examples –> 01.Basics –> Blink.

Click this button to compile and run the source code. Please check the status of LED1, is it blinking?

Note: The compiled binary file is saved at /home/linaro/Arduino. So you can manually run this file on Linux terminal.

If you want to create a new design, just enter Ctrl+n, and open a window to input source code.

This is the source code, if you have used Arduino before, you will notice that the programming language has no big difference between Arduino and pcDuino.

int led_pin = 5;
/*
* Button LED test program
*/

#include <core.h>

int led_pin = 13;
int btn_pin = 6;

void setup() {
    if ( argc == 3 ) {
        btn_pin = atoi(argv[1]);
        led_pin = atoi(argv[2]);
    }
//set the gpio to input or output mode
    pinMode(led_pin, OUTPUT);
    pinMode(btn_pin, INPUT);
}

void loop() {
//press btn_pin to turn on LED
    int value = digitalRead(btn_pin);
    if ( value == HIGH )
    { // button pressed
        digitalWrite(led_pin, HIGH); // turn on LED
    } else { // button released
        digitalWrite(led_pin, LOW); // turn off LED
    }

    delay(100);
}

Share!
Tweet

Olva

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors