// ------------
// ECE 210 - Lab 5
// ------------
/*-------------
-------------*/
// constants won't change. They're used here to set pin numbers:
const int VL = 4; // the number of the swich pin, VL stands for logic voltage
const int PR = 3; // the number of the LED pin, PR stands for red probe
const int PG = 10; // the number of the LED pin, PG stand for green probe
const int VP = A0; // select the input pin for the potentiometer
// variables will change:
int Duty; // duty ratio of on-state in percentage
//declares the inputs and outputs of the circuit
void setup() {
pinMode(A0, INPUT);
pinMode(VL, INPUT);
pinMode(PR, OUTPUT);
pinMode(PG, OUTPUT);
}
// your code written here keeps running until eternity
void loop() {
Duty = analogRead(VP)/4;
analogWrite(PR,Duty);
analogWrite(PG,Duty);
}