Pocket

For about Arduino, refer to http://www.arduino.cc/.

This tutorial describes a way of making Arduino sample of Arduino web site on Argo Embetics.
For preparation of using Arduino, refer to “Getting Started with Arduino”.

First, the same project as “Getting Started with Arduino” is necessary. New project or copyed project.

This tutorial describes about “Basics” sample.
For Arduino sample, refer to Learning page.

1.Basics

DigitalReadSerial

    • Serial.begin(9600);Open “Serial” Module element and check baud rate. Because default value is 9600, use without modifying.
    • pinMode(2,INPUT);Open “P2” Port element and check I/O. Because default value is I (Input), use without modifying. Validate Serial and PortDisplay Platform Link form and validate Serial communication and P2 Port.
      Setting for the below code.

    Settings of setup() function is complete.

  1. Make loop() functionThe contents of loop() function is as below.int buttonState = digitalRead(pushButton);
    Serial.println(buttonState);
    delay(1);Apply this processing to Logic.

    • int buttonState = digitalRead(pushButton);This is reading of P2. Insert P2.
      First, input “int buttonState = “.Then, insert P2.
      Add “;” then finish.

    • Serial.println(buttonState);Insert serial communication function.
      Select “Print with new line”.

      The following function will be inserted.
      Change “val” to “buttonState” and add “;”.
    • delay(1);”delay()” is defined in Time Module. Validate it, too.
      It is necessary to re-display Logic to Time Module. Click Update and re-display Logic.Select “Delay(me)” of Time Module.

      Change “u4Ms” to “1” and add “;”.

    Logic is complete. After updating Logic and generate code, you can run it on Arduino.

AnalogReadSerial

The code of “AnalogReadSerial” is as below.

  • setup()Serial.begin(9600);
  • loop()int sensorValue = analogRead(A0);
    Serial.println(sensorValue);
    delay(1);

  1. Validate Serial and PortValidate the following elements.
  2. Make LogicDifference with DigitalReadSerial is only “analogRead(A0)”.
    After inserting “Analog IN P0”, the following Logic will be complete.

  • FadeThe code of “Fade” is as below.
    • Variableint led = 9;
      int brightness = 0;
      int fadeAmount = 5;
    • setup()pinMode(led, OUTPUT);
    • loop()analogWrite(led, brightness);
      brightness = brightness + fadeAmount;
      if (brightness == 0 || brightness == 255) {
      fadeAmount = -fadeAmount ;
      }
      delay(30);

    1. Validate Platform Model
      Also validate Time Module to use “delay()”.
    2. Make VariableMake brightness and fadeAmount as Process Local Data.
      Display edit form by right-click. Modify contents as below.
    3. Make logic
      • analogWrite(led, brightness);For “analogWrite(led, brightness);”, insert Port element. Insert Process Local Data “brightness” as below.
        You can also insert Process Local Data by double-click.
      • Make the rest in the same way
    4. Sequential logic version
      • Logic is complete. The below Logic is the same processing but Sequential Logic not code.

For the operation of Sequential Logic, refer to “Argo Embetics Tutorial #2”.

This tutorial has described the way of making Arduino sample.
For making other Model, refer to other tutorial, user’s guide or help.

The re-configurable Module and Logic are also provied there. Make use of them with Argo Embetics for various development.

Please send an e-mail to argo-embetics@argo-s.com to connect with us when you have any question about Argo Embetics or our company.

Latest information about Argo Embetics is on:

http://www.argo-s.com/ae_en/