| 1 |
/* |
| 2 |
This file is part of IanniX, a graphical real-time open-source sequencer for digital art |
| 3 |
Copyright (C) 2010-2015 — IanniX Association |
| 4 |
|
| 5 |
Project Manager: Thierry Coduys (http://www.le-hub.org) |
| 6 |
Development: Guillaume Jacquemin (https://www.buzzinglight.com) |
| 7 |
|
| 8 |
This file was written by Guillaume Jacquemin. |
| 9 |
|
| 10 |
IanniX is a free software: you can redistribute it and/or modify |
| 11 |
it under the terms of the GNU General Public License as published by |
| 12 |
the Free Software Foundation, either version 3 of the License, or |
| 13 |
any later version. |
| 14 |
|
| 15 |
This program is distributed in the hope that it will be useful, |
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
GNU General Public License for more details. |
| 19 |
|
| 20 |
You should have received a copy of the GNU General Public License |
| 21 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 |
*/ |
| 23 |
|
| 24 |
#include "iannix_lib.h" |
| 25 |
|
| 26 |
void setup() { |
| 27 |
IanniX::setup(); |
| 28 |
IanniX::send("zoom 110"); |
| 29 |
} |
| 30 |
|
| 31 |
float value = 0; |
| 32 |
void loop() { |
| 33 |
//Get analog value from PIN A0 (Arduino UNO) |
| 34 |
float dest = analogRead(0); |
| 35 |
//Smooth value |
| 36 |
value = value + (dest - value) / 5; |
| 37 |
|
| 38 |
//Control zoom with sensor on PIN A0 (Arduino Uno) |
| 39 |
Serial.print("zoom "); |
| 40 |
Serial.println(value); |
| 41 |
delay(10); |
| 42 |
|
| 43 |
//Reception of events from IanniX |
| 44 |
if((IanniX::hasData()) && (IanniX::count() >= 3)) |
| 45 |
tone(IanniX::toInt(1), IanniX::toInt(2), IanniX::toInt(3)); |
| 46 |
} |
| 47 |
|