0

I need to add 2 buttons, One that increases the threshold and One that decreases the threshold once u changed It the led gonna turn up at another value.

My Code:

#include <LiquidCrystal.h>

#define analogInput 0

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);  

    float vout = 0.0;

    float vin = 0.0;

     float R1 = 100000.0;   

    int value = 0;

 

void setup(){

   lcd.begin(16, 2);

   lcd.print("VOLTMETRO DC");

   Serial.begin(9600);

   pinMode(6, OUTPUT);

}

void loop(){

   value = analogRead(analogInput);

   vout = (value * 5.0) / 1024.0; 

   // inserire al posto di 5.0V l`uscita in volt tra i Pin 5V e GND di Arduino

lcd.setCursor(0, 1);

lcd.print(" "); 

lcd.setCursor(0, 1);

lcd.print("INPUT V= ");

lcd.print(vout);

  

if(vout > 2.5)

{

  digitalWrite(6,HIGH);

  lcd.setCursor(15, 0);

  lcd.blink();

}

else

{

  digitalWrite(6,LOW);

  lcd.setCursor(15, 0);

  lcd.noBlink();

}

delay(500);

}

My circuit: https://ibb.co/85rx3gf

9
  • ibb.co/85rx3gf thats the display – il king dei kings May 14 at 14:31
  • Please post your code directly, not a link to it. Also describe what the code does and how it does it (we can't see inside your head). – Majenko May 14 at 14:33
  • It simply turns on a led with a certain voltage value that se change by increasing or decreasing It. And thats what i need to do the thing that increases or decreases this value with 2 buttons , i cant post the sketch here cuz It gives me error for some reason – il king dei kings May 14 at 14:41
  • You talk about blinking an LED then give us code that does things with an LCD screen. And there's no buttons in your circuit to read. – Majenko May 14 at 14:44
  • 1
    The sketch thing idk i need that part of program idk how to do it – il king dei kings May 14 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.