Problem solving

I’m new to doing this, So need some help I’m doing this on tinkercad but I seem to not have it right so reaching out for some help..

I am trying to get the actual read out to be on the same line as the “HZ” on top screen
Rather then screen below..

Anyone have some help in doing this code properly please and thank you in advance..


#include <LiquidCrystal.h>
LiquidCrystal 1cd(12, 11, 5, 4, 3, 2);
int X = 0;
int ti void
setup () {
Serial.begin (9600);
1cd. begin (16, 2);
lcd.print("
HZ") ;
pinMode (7, INPUT) ; digitalWrite(7, HIGH) ; pinMode (9, INPUT) ;
digitalWrite(9, HIGH);
pinMode (10, OUTPUT) ;
void 100p() {
if (digitalRead (9)==0)
{ x++;
analogWrite (10,x);
}
else if (digitalRead (7)==0)
メー;
analogwrite (10,x);
}
else {analogWrite (10, x) ;} x=constrain (x, 0,255);
delay (20) ;
t = map (x, 0,255,0,17552) ;

t=constrain(t, 0,17552);
1cd. setCursor (0,1);
1cd. print (t);
}
  • Please read the forum posting guidelines.

  • In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.
    Use the < CODE / > icon from the ‘posting menu’ to attach the copied sketch.

  • For a 2x16 display:

lcd.setCursor(0, 0); // top left
lcd.setCursor(15, 0); // top right
lcd.setCursor(0, 1); // bottom left
lcd.setCursor(15, 1); // bottom right
1 Like

I think I did that right this time thank you sorry new to all this..

Any help greatly appreciated thank you

I've moved your post from the "uncategorized section" to a more appropriate place.

1 Like

Please do the following:

  • in the IDE, press ctrl-T to format your code, and fix any errors that become evident.
  • press ctrl-shft-c to copy your complete code
  • in a new message in this topic, press ctrl-v to insert the code properly, then add some commentary about what you're seeing/not seeing, or what compile errors are giving you trouble if there are some.
    Thank you.

Would that perchance be
x--;

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int x = 0;
int t;
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print(" HZ");
pinMode(7,INPUT);
digitalWrite(7,HIGH);
pinMode(9,INPUT);
digitalWrite(9,HIGH);
pinMode(10,OUTPUT);
}

void loop() {
if (digitalRead(9)==0)
{
x++;
analogWrite(10,x);
}
else if (digitalRead(7)==0)
{
x--;
analogWrite(10,x);
}
else {analogWrite(10,x);}
x=constrain(x,0,255);
delay(20);
t = map(x,0,255,0,17552);
t=constrain(t,0,17552);
lcd.setCursor(1,1);
lcd.print(t);

}

not getting any errors

I'm trying to get the "hz" & the digital read out to be on the same line

I hope I'm explaining this right

apologize for not knowing much about this trying to tech myself how to program a LCD screen to display what I need.

im not to good at computer things

#include <LiquidCrystal.h> 
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int x = 0; 
int t; 
void setup() { 
  Serial.begin(9600);
      lcd.begin(16, 2);
    lcd.print("    HZ"); 
  pinMode(7,INPUT); 
  digitalWrite(7,HIGH);
  pinMode(9,INPUT); 
  digitalWrite(9,HIGH);
  pinMode(10,OUTPUT); 
}

void loop() { 
   if (digitalRead(9)==0)
  {
    x++;
   analogWrite(10,x);
  }
  else if (digitalRead(7)==0)
  {
    x--;
    analogWrite(10,x);
  }
  else {analogWrite(10,x);}
  x=constrain(x,0,255);
    delay(20); 
  t = map(x,0,255,0,17552); 
  t=constrain(t,0,17552);
lcd.setCursor(1,1); 
    lcd.print(t); 
 
}

dang thank you that worked!!!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.