1 Nisan 2013 Pazartesi

Arduino Esplora LED Show

Hamza Öztaş Share:
Image Hosted by ImageShack.us
Image Hosted by ImageShack.us

Code;



#include <Esplora.h>

void setup() {
  Serial.begin(9600);
}
int lowLight = 400;   // the light sensor reading when it's covered
int highLight = 1023; // the maximum light sensor reading
int minGreen = 0;     // minimum brightness of the green LED
int maxGreen = 100;   // maximum brightness of the green LED

void loop() {
  int mic = Esplora.readMicrophone();
  int light = Esplora.readLightSensor();
  int slider = Esplora.readSlider();

  byte red   = constrain(mic, 0, 255);
  byte green = constrain(
                  map(light, lowLight, highLight, minGreen, maxGreen),
                  0, 255);
  byte blue  = slider/4;
  Serial.print(red);
  Serial.print(' ');
  Serial.print(green);
  Serial.print(' ');
  Serial.println(blue);
  Esplora.writeRGB(red, green, blue);
  delay(10);
}


Tarafından Yayınlandı >> Hamza Öztaş

Hamza Öztaş'ı google plus'ta takip etmek için Google'a tıklayın;
Google+.

0 yorum:

Get Updates in your Email
Complete the form below, and we'll send you our best of articles.

İletişim

© >> |
TOP