<commit_before># Ivory programing on Arduino

## Demo code

The Ivory code is found at following:

* [Example 01: Blinking LED](./demo/01_blink/MainIvory.hs)

## Hardware: [Arduino Uno](http://arduino.cc/en/Main/ArduinoBoardUno)

[![](_img/ArduinoUnoR3.jpg)](http://arduino.cc/en/Main/ArduinoBoardUno)

* CPU: ATmega328 ([Atmel AVR](http://www.atmel.com/products/microcontrollers/avr/) 8-bit)
* Flash ROM: 32 kB
* SRAM: 2 kB

Also you could get [compatible boards](http://www.sainsmart.com/arduino/control-boards/sainsmart-uno-atmega328p-pu-atmega8u2-microcontroller-for-arduino.html)


## Setup environment

### [Debian GNU/Linux](https://www.debian.org/)

Install some packages.

```
$ sudo vi /etc/apt/preferences.d/avr
Package: avrdude
Pin: version 6.1*
Pin-Priority: 1001
$ sudo apt-get install binutils-avr gcc-avr avr-libc avrdude libgmp-dev
```

### Mac OS X

Install gmp package.

```
$ brew install gmp
```

Install AVR toolchain http://www.obdev.at/products/crosspack/index.html, and set PATH env.

```
$ export PATH=$PATH:/usr/local/CrossPack-AVR/bin
$ which avr-gcc
/usr/local/CrossPack-AVR/bin/avr-gcc
```

### Windows

Install following package on [cygwin](https://www.cygwin.com/).

* git
* gcc-core
* libgc-devel
* libgmp-devel
* make

Install AVR toolchain http://winavr.sourceforge.net/.

T.B.D.


## How to build

Install ATS2 http://www.ats-lang.org/.

```
$ tar xf ATS2-Postiats-X.Y.Z.tgz
$ export PATSHOME=`pwd`/ATS2-Postiats-X.Y.Z
$ export PATH=${PATSHOME}/bin:${PATH}
$ tar xf ATS2-Postiats-contrib-X.Y.Z.tgz
$ export PATSHOMERELOC=`pwd`/ATS2-Postiats-contrib-X.Y.Z
$ cd ${PATSHOME}
$ ./configure
$ make
```

Compile the ATS source code for Arduino.
<commit_msg>Doesn't need gmp<commit_after># Ivory programing on Arduino

## Demo code

The Ivory code is found at following:

* [Example 01: Blinking LED](./demo/01_blink/MainIvory.hs)

## Hardware: [Arduino Uno](http://arduino.cc/en/Main/ArduinoBoardUno)

[![](_img/ArduinoUnoR3.jpg)](http://arduino.cc/en/Main/ArduinoBoardUno)

* CPU: ATmega328 ([Atmel AVR](http://www.atmel.com/products/microcontrollers/avr/) 8-bit)
* Flash ROM: 32 kB
* SRAM: 2 kB

Also you could get [compatible boards](http://www.sainsmart.com/arduino/control-boards/sainsmart-uno-atmega328p-pu-atmega8u2-microcontroller-for-arduino.html)


## Setup environment

### [Debian GNU/Linux](https://www.debian.org/)

Install some packages.

```
$ sudo vi /etc/apt/preferences.d/avr
Package: avrdude
Pin: version 6.1*
Pin-Priority: 1001
$ sudo apt-get install binutils-avr gcc-avr avr-libc avrdude
```

### Mac OS X

Install AVR toolchain http://www.obdev.at/products/crosspack/index.html, and set PATH env.

```
$ export PATH=$PATH:/usr/local/CrossPack-AVR/bin
$ which avr-gcc
/usr/local/CrossPack-AVR/bin/avr-gcc
```

### Windows

Install following package on [cygwin](https://www.cygwin.com/).

* git
* make

Install AVR toolchain http://winavr.sourceforge.net/.

T.B.D.


## How to build

Install ATS2 http://www.ats-lang.org/.

```
$ tar xf ATS2-Postiats-X.Y.Z.tgz
$ export PATSHOME=`pwd`/ATS2-Postiats-X.Y.Z
$ export PATH=${PATSHOME}/bin:${PATH}
$ tar xf ATS2-Postiats-contrib-X.Y.Z.tgz
$ export PATSHOMERELOC=`pwd`/ATS2-Postiats-contrib-X.Y.Z
$ cd ${PATSHOME}
$ ./configure
$ make
```

Compile the ATS source code for Arduino.

{'fraction_non_alphanumeric': 0.16605616605616605, 'fraction_numerical': 0.017094017094017096, 'mean_word_length': 4.072755417956657, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 12, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4949921', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1310, 'n_words': 256}