int LED=10; //This line creates an integer variable LED
// and assigns it to value 10
int sensorPin = 3; //assigns the integer sensorPin to 3.
void setup() {
// put your setup code here, to run once:
pinMode(LED, OUTPUT); //This makes Pin 10 an OUTPUT
Serial.begin(9600); //Setup Serial library for Serial Monitor
//at 9600 bps
}
void loop() {
// put your main code here, to run repeatedly:
int sensorValue; //creates an integer variable sensorValue.
sensorValue = analogRead(sensorPin)*5; //sensorValue is whatever the state sensorPin is in.
Serial.println(sensorValue); //prints value of sensorValue
//this should go after sensorPin has been read.
analogWrite(LED, sensorValue); //sets Pin-10 to whatever the sensorValue is and tunrs it on
delay(sensorValue); //stop for the sensor value
analogWrite(LED, 0); //sets Pin-10 to 0V and turns it off
delay(sensorValue); //stop for the sensor value
}