Filter results by

First Exercise: Say Hello to Artie

Now that you have your ARTIK developer board powered up, and your terminal emulator program connected and working, let's start by playing with ARTIK audio.

The first section of this tutorial will familiarize you with the command line interface. The optional second section includes a more difficult topic: Linux® services like the editor, compiler, and file transfer commands that you'll eventually need.

Prerequisites

You'll just need a set of speakers or headphones. Plug them in now. The ARTIK development board comes with everything else, including a built-in microphone.

artik 7 artik 5 and 10

Capture Audio

Let's record an audio clip. At your Linux command prompt (#), type in the line below.
arecord -f dat test.wav

Now say something, like "Hello, Artie!" Or maybe you can hum a tune.

When finished, type Ctrl-C to close your first recording session.

Play Back Audio

Type in the line below.
aplay test.wav

You should hear your recording played back.

Set the Mixer

Was your recording volume set too low? Let's apply higher gain settings to the mixer.
amixer sset "Mic Gain Control" 6

Rather than typing this in, try copying it and pasting it from the screen.

  • Highlight and copy in the normal way for your operating system.
  • To paste in the terminal emulator window, click the right mouse button.

A little easier than manual typing, isn't it? We'll be doing a lot of copying and pasting in the tutorials ahead.

Try your recording again and see if it comes out louder this time.

Summary

ARTIK is all about making things simple. There's no reason for you to reinvent the wheel when taking on a project – just start with the software that comes pre-loaded. Later, we'll show you how to download and install new programs and libraries over the Internet.

Wondering what other great software came pre-installed on your ARTIK? Use this command to get a list by name and short summary. If something looks interesting you can get more information online.

rpm -qa --qf '%{NAME}: %{SUMMARY}\n' | sort -f

The next tutorials demonstrate how you can control outputs and monitor inputs using the command line techniques you just tried. They go on to demonstrate the same procedures using C code and Python.

Extra Credit: Linux Essentials

In the course of the coming tutorials, you will be presented with Arduino, Python, and C code snippets. You don't need to be a Linux expert to try these out. But you may need to brush up on a few essential Linux command line skills.

In case you find it helpful, we present here some tips on how to compile and run the code snippets, as well as how to perform basic file transfers.

Using vi

The code we provide in the tutorials can be saved to a file on ARTIK by copying from the Web page and pasting into the Linux editor vi. That is, you do not need to use a file transfer program like scp.

  1. At the Linux command prompt (#), start the editor with an existing or new file.
    Examples: vi testfile.c or vi testfile.py

  2. Select and copy the code snippet from the Web page using the normal methods for your OS.

  1. Paste the code into the vi editor:
    • Use the cursor keys to position the cursor at the head of the file
    • Hit [Insert] (otherwise you will not be able to add anything)
    • Hit [Enter] to create a blank line, and hit the Up arrow to go to it
    • Right-click the mouse to paste the copied section.
  2. Hit [Esc] - [:] - [w] - [q] - [Enter] to write the changes and exit.

Compiling C Code using gcc

You can compile your C code from the Linux command prompt. The gcc compiler comes pre-installed.

  1. Save your code snippet to a file using vi as described above.

  2. Compile your code with a command line like this.
    # gcc testfile.c -o testfile

  3. Run the compiled program with a command like this.
    # ./testfile

Loading and Running Python Scripts

You can run a saved Python script from the Linux command prompt; Python comes pre-installed.

  1. Save your Python script to a file using vi as described above.

  2. Launch the interpreter and script from the command line.
    # python testfile.py

Using an Integrated Development Environment (IDE)

Arduino and Eclipse both provide an integrated development environment with hundreds of downloadable libraries available for simplifying all sorts of tasks.

Refer to the Eclipse IDE and Arduino IDE guides for full details.

Linux scp

Once you have a network connection between your PC and ARTIK as described here, you can use scp to transfer files. For example, if you're not fond of editing in vi, you can compose a C code file on your local PC editing program and then copy it over to your ARTIK board. The Linux section of that article shows how to use it.

Last updated on: