# Getting started with the Primary Mission

The kit is based on an Arduino compatible development board called Teensy. This means that, other than the name, the board is to be viewed as an Arduino and programmed as such. The programming language that is used is C, but in a «variant» of it which is often reffered to as it’s own language, Arduino, but is really a set of libraries hidden to the user to make programming of the Arduino boards easier to learn and use. Often programs that are written in Arduino can be used across many boards as they are ment to be as cross-compatible as possible, but some of the features of one boards is not existing on others, so there are exceptions to this. This will be the same for you when using the Teensy.

On the Teensy there is many pins that can be connected to external peripherals and devices. The pins can work in two ways: as inputs and outputs. If the pin is used as an input, the program measures what the voltage level is on the pin and returns that to the user. If the pin is used as an output, the user tells in the program what the voltage level should be on that pin and the microcontroller actually forces that voltage to be that value (either digital or analog, see below).

The Teensy is more powerful than most other Arduino boards, and all pins has more than one function. The pin functions can be divided into two categories: digital and analog. The digital pin functions can measure digital input and also output digital values. Digital values are either high (also often given as a ‘1’) value, in this case 3.3V, or a low value (often called ‘0’) with a voltage level of 0 volts. When it measure/samples a pin, that is measuring what the voltage is on that pin, it measures a high/true/1 if the levels are 3.3V or close to it. If it measures 0 volts or close to it, it registers it as a low/false/0. If the voltage is, for some reason, not close to either 0 or 3.3V however, the output can be either registered as a high or low, dependent of several factors. Computers live in a digital world and the usages of only measuring binary/digital values are huge, and one advantage is that it is extremely fast: the Teensy can output/input a digital values in less than 10 nano seconds!

We have discussed digital input/output pins already, but it is a sub-category of digital pins we have not yet talked about. There are only two voltage levels on digital pins, but the voltage levels can vary in time in many (infinite) different ways. The most popular way to communicate with the outside world is through serial communication: this is where one or a few pins vary dependently on each other in a very specific way based on some standard. You are guaranteed to have heard of USB communication: this is a serial protocol with two wires working together as one output in a special way (if we dont consider the new variants) to communicate in a extremely fast, standardized fasion between devices. In the embedded world of microcontrollers there are numerous other serial communication standards, with UART, SPI and I2C as one of the more famous/widespread, but all of these work with the same basic idea: alternating one/few pins in a specific way in time makes communication fast, cheap and simple. There are reasons not to use parallel communication which was very popular in the 80s and 90s which we will not come into here.

## Installing software

You will also need the Teensyduino, which is a small add-on to the Arduino IDE to simplify programming your Cansat. It can be downloaded here. There are options for Linux and Mac for both Arduino IDE and Teensyduino, but we will not discuss that here.

After installing the Arduino IDE and Teensyduino, run the IDE. NAROM has written two libraries to simplify working with the Cansat kit. Download the libraries for the transceiver here and the GY-91 sensor here and save them to the hard drive. In the Arduino IDE, klick the «Sketch» menu, further into «Include library» and press «Add .ZIP Library…». The menu will then prompt you for the location of the zip files, but choose only one of them and press OK, and the Arduino IDE will import the library. Do this for both libraries, and you should be good to go.