Problem with if command and thisChar in lcd project


i changed default lcd autoscroll code change go 1 12. try add
code: [select]
if (thischar == 10)
{
  lcd.clear();
}


to see if make lcd screen clear.

it gives me error code
code: [select]
arduino: 1.8.3 (windows store 1.8.6.0) (windows 10), board: "arduino/genuino uno"

test_1234:11: error: expected unqualified-id before 'if'

 if (thischar == 10)

 ^

exit status 1
expected unqualified-id before 'if'

this report have more information with
"show verbose output during compilation"
option enabled in file -> preferences.




here actual code
code: [select]
#include <liquidcrystal.h>

// initialize library numbers of interface pins
liquidcrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set lcd's number of columns , rows:
  lcd.begin(16, 2);
}

if (thischar == 10)
{
  lcd.clear();
}


void loop() {
  // set cursor (0,0):
  lcd.setcursor(0, 0);
  // print 0 9:
  (int thischar = 1; thischar < 112; thischar++) {
    lcd.print(thischar);
    delay(1000);
  }

  // set cursor (16,1):
  lcd.setcursor(16, 1);
  // set display automatically scroll:
  lcd.autoscroll();
  // print 0 9:
  (int thischar = 1; thischar < 12; thischar++) {
    lcd.print(thischar);
    delay(1000);
  }
  // turn off automatic scrolling
  lcd.noautoscroll();

  // clear screen next loop:
  lcd.clear();
}




eventually want make hour long timer uses buzzer beep after hour. testing
code: [select]
thischar command
code: [select]
lcd.clear();  see if buzzer work.


can me this

your "if" not inside code block.


Arduino Forum > Using Arduino > Programming Questions > Problem with if command and thisChar in lcd project


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts