I would like some help to edit my code.

Greetings Arduino Commuinity,

I was trying to implement the idea that when the cursor reaches the end of the LCD display in the Arduino Starter Kit, it would clear the screen and continue with the program. But, a void error message appeared:

"Arduino: 1.6.5 (Mac OS X), Board: “Arduino Uno”

Binary.ino: In function ‘void loop()’:
Binary:42: error: invalid use of ‘void’
invalid use of ‘void’

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences."

Here is the piece of code that gave this error message:

while(lcd.cursor() = (16,0)){

Can anyone please help me with this program?

Thank you,

P.S. I also have a picture of the project I am working on.

Binary.ino (779 Bytes)

while(lcd.cursor() = (16,0)){

Can you explain what you think that code does?

Does this help understand the error message?

void LiquidCrystal::cursor() {
  _displaycontrol |= LCD_CURSORON;
  command(LCD_DISPLAYCONTROL | _displaycontrol);

while(lcd.cursor() = (16,0)){The lcd.cursor() function moves the cursor, it does not return the current cursor position, ie the function is void, hence the error message.

I have not downloaded your code, please post it here, but if you need to know where the cursor is then you must hold its current values in variables and test those values.

For such a small amount of code, please just post all of it, instead of requiring people to download it.

// Include LCD library and define new LCD Display
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11 ,5 , 4, 3, 2);

// Create constant for contrast
const int cont = 7;

// Create constatnt called switchPin
const int switchPin = 8;

// Create variable called switchState
int switchState = 0;

void setup() {
  // Start LCD
  lcd.begin(16, 2);

  // Set contrast to output
  pinMode(cont, OUTPUT);

  // Set switchPin to Output
  pinMode(switchPin, OUTPUT);


void loop() {

  // Low contrast
  digitalWrite(cont, LOW);

  // Set switchState to read the input of switchPin
  switchState = digitalRead(switchPin);

  if(switchState == LOW){
  while(lcd.cursor() = (16,0)){
  while(lcd.cursor() = (16,0)){

It's hard to know where to start here. For one thing, comparisons need ==, not just =.

For another, (16,0) is meaningless here.

lcd.cursor() doesn't return two numbers, does it?

lcd.cursor() doesn't return two numbers, does it?

It need not. (16,0) evaluates to a single value.