Para começar a série de exemplos de aplicações com arduino, pensei em algo simples para demonstrar.
![]()
Um circuito que utiliza como input um ldr (photoresistor) onde a partir da luminosidade defini um som para o ambiente.
![]()
Neste caso, vamos usar o velho e bom exemplo, de noite som de grilos e sapos e de dia o som de pássaros. =)
O circuito:
O código: (fonte)
import processing.serial.*;
import cc.arduino.*;
import ddf.minim.*;
Arduino arduino;
int ldrPin = 1;
int ldrVal = 0;
int boundary = 1000;
AudioPlayer audioDay;
AudioPlayer audioNight;
void setup() {
size(40, 40);
Minim.start(this);
audioDay = Minim.loadFile("audioDay.mp3");
audioNight = Minim.loadFile("audioNight.mp3");
arduino = new Arduino(this, Arduino.list()[0], 57600);
arduino.pinMode(ldrPin, Arduino.INPUT);
}
void draw() {
ldrVal = arduino.analogRead(ldrPin);
if(ldrVal >= boundary) {
audioDay.pause();
if(!audioNight.isPlaying()) audioNight.loop();
} else {
audioNight.pause();
if(!audioDay.isPlaying()) audioDay.loop();
}
}
void stop()
{
audioDay.close();
audioNight.close();
super.stop();
}
Os sons utilizados foram encontrados no site Free Sound Project.
A biblioteca utilizada no processing para ativar os sons foi a Minim .
Não podemos esquecer que o arduino deve estar carregado com a interface para processing.

Eu gostaria de saber se não tem como voces me mandar,alguns conteudo sobre programação do arduino ou do tatuino.
Pois eu ainda estou estudando os condigo deles…
Desde ja obriagado.
Fala Felipe,
Tem o site do arduino que tem muita informação.
http://arduino.cc/
Hello there, You’ve performed a fantastic job. I’ll certainly digg it and in my view recommend to my friends. I’m confident they’ll be benefited from this web site.
Hey, mind if I bend your ear a bit? I have something important that you might like
My buddies and I (we’re from Florida) have been watching this blog for a while and we really like it so we decided to share something with you that’s been working for our websites. I’m not sure if you knew this, but building an email list is HUGE. You can increase your visitors, and if you monitize them correctly, they can be a serious gold mine. There is a lot I would love to talk to you about that you can do to increase your revenue here. However, I won’t do it justice. Just go here instead: http://www.make1150weekly.info/ and check out what these crazy guys are doing. Personally, I have revamped all of my sites (didn’t take much time at all) and I’m making a steady $200-$400 DAILY, swear on my mother I made $274 yesterday from blogs. Amazing huh? Just a couple weeks ago, I was happy scraping by with 6 bucks a day on adsense heh. Check it out, really. You’ll be doing yourself a huge favor.