Project 1


The Wood Leaves Wind Indicator prototype:

 

IMG_2608

 

 

Code:

 

 

int analogInPin1 = A0;
int analogInPin2 = A1;
int analogInPin3 = A2;

int ledPin1 =9;
int ledPin2= 8;
int ledPin3= 7;

int sensorValue1 = 0;
int outputValue1 = 0;
int sensorValue2 = 0;
int outputValue2 = 0;
int sensorValue3 = 0;
int outputValue3 = 0;

void setup() {
Serial.begin(9600);
// nothing happens in setup
}

void loop() {
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=15) {
// fade in from min to max in increments of 5 points:
sensorValue1 = analogRead(analogInPin1);
outputValue1= map(sensorValue1, 0, 1000, 0, 255);
analogWrite(ledPin1, outputValue1);

for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// fade in from min to max in increments of 5 points:
sensorValue2 = analogRead(analogInPin2);
outputValue2= map(sensorValue2, 0, 1000, 0, 255);
analogWrite(ledPin2, outputValue2);
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=15) {
// fade in from min to max in increments of 5 points:
sensorValue3 = analogRead(analogInPin3);
outputValue3= map(sensorValue3, 0, 1000, 0, 255);
analogWrite(ledPin3, outputValue3);

Serial.print(“sensor1 = ” );
Serial.print(sensorValue1);
Serial.print(“\t output1 = “);
Serial.println(outputValue1);

Serial.print(“sensor2 = ” );
Serial.print(sensorValue2);
Serial.print(“\t output2 = “);
Serial.println(outputValue2);
Serial.print(“sensor3 = ” );
Serial.print(sensorValue3);
Serial.print(“\t output3 = “);
Serial.println(outputValue3);

delay(400);

}}}}

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: