1/08/2014

(Arduino Study) Led on/off duration changed by value of brightness is checked by potentiometer

the simple source code

---
int sensorPin = A0;
int ledPin = 13;
int ledBrightnessPin = 12;
int sensorValue = 0;

void setup(){
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}


void loop(){
  sensorValue = analogRead(sensorPin);
  
  Serial.print(sensorValue);
  Serial.print("\n");
  digitalWrite(ledPin, HIGH);
  delay(sensorValue);
  digitalWrite(ledPin, LOW);
  delay(sensorValue);
}
...