Created
June 27, 2015 13:45
-
-
Save michaelsarduino/10f719064aa53a9e26a7 to your computer and use it in GitHub Desktop.
Arduino Disco Processing PC Sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ddf.minim.*; //nachladen der Audiobibliotehk | |
import processing.serial.*; //nachladen der serial Bibliothek | |
Serial arduino; //erstellen des Objekts arduino vom Typ Serial | |
Minim minim; | |
AudioPlayer player; | |
void setup () { | |
String port = Serial.list()[0]; //speichern der Verbindungsdaten | |
arduino = new Serial(this, port, 9600); //starten der seriellen Verbindung | |
//Audiodatei laden und abspielen | |
minim = new Minim (this); | |
player = minim.loadFile ("sand.mp3"); | |
player.play (); | |
} | |
void draw () { | |
float speicher = player.mix.level() * 250; //aktueller Lautstaerkepegel mal 250 | |
int staerke = int(speicher); //umwandeln in Integer | |
arduino.write(staerke); //senden an Arduino | |
delay(11); //kurzes warten | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment