//ENME461 Lab 1, P1 and P2. Simple Blinking LED
/////highlight and hit ctrl + / to undo all //.
// //PART 1 (GREEN):
// void setup() {
// pinMode(2, OUTPUT);
// }
// void loop() {
// digitalWrite(2, HIGH); //turn LED on
// delay(1000); //wait one second
// digitalWrite(2, LOW); //turn LED off
// delay(1000);
// }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//PART 2: using potentiometer: (BLUE!)
int ledPin = 5;
int potPin = A0;
int potVal;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600); //opens up serial window
}
void loop() {
potVal = analogRead(potPin);
Serial.println(potVal); //print to computer serial monitor.
digitalWrite(ledPin, HIGH); //turn pin on
delay(potVal); //delays by the microseconds of value of the potentiometer reading signal.
digitalWrite(ledPin, LOW); //turn pin off
delay(potVal);
}