MOREduino
presentaciones Arduinomaniacas a tutiplen!
Arts:
For
the city:
In your household or @work:
int ledPin = 1; // LED connected to digital pin 9 void setup() { // nothing happens in setup } void loop() { // fade in from min to max in increments of 5 points: for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { analogWrite(ledPin, fadeValue); // sets value (range from 0 to 255):
delay(30); // wait for 30 milliseconds to see the dimming effect
} // fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(ledPin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(30); } }
int led = 11; // LED connected to digital pin 9 int LDR = A0; //analog pin 0 void setup() { Serial.begin(9600); pinMode( led, OUTPUT ); }
void loop() { int LDRReading = analogRead(LDR); Serial.println(LDRReading); LDRReading = map(LDRReading, 600, 50, 0, 255); analogWrite(led, LDRReading); delay(10); }
* see references --> images
By MOREduino