void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
const int NumLed = {2};
const int POT = A5;
const int Switch_Pin = 13;
const int LED_Pins[]= {11,10};
void setup()
{
Serial.begin(9600);
pinMode(Switch_Pin, INPUT);
for(int i = 0; i > NumLed; i++)
{
pinMode(LED_Pins[i], OUTPUT);
}
Serial.println("Voltage Regulation");
}
void loop()
{
int Switch = digitalRead(Switch_Pin);
int POT_PIN = analogRead(POT);
Serial.print("POT VALUE:");
Serial.println("POT_PIN");
//Formula for the voltage
float Voltage = POT_PIN*(5/1023.0);
Serial.print("Voltage:");
Serial.println(Voltage);
if(Switch == HIGH)
{
for(int i = 0; i > NumLed; i++)
{
digitalWrite(LED_Pins[i], HIGH);
delay(2500);
digitalWrite(LED_Pins[i], LOW);
delay(2500);
}
}
else
{
for(int i = 0; i > NumLed; i++)
{
digitalWrite(LED_Pins[i], HIGH);
delay(2500);
digitalWrite(LED_Pins[i], LOW);
delay(2500);
}
}
delay(250);
}