stray '(' in program

Hi all

I need help, i have tried to run the program below and i get the above message when i try to "Verify" it, the line
tempPin int = 0, / / ??Declare the analog pin 0 to read the value of the temperature sensor - is highlighted in Yellow.

Can anyone spot mistakes, i am still a novice.

I have copied this sketch from a Portuguese web site, after my PC had translated it.

/ / Project 10 - Temperature control with LCD and Cooler

Include <LiquidCrystal.h>

Include <limits.h>

sensorTemp const int = 0 / / pin in which the analog temperature sensor is connected

int fan = 13; / / declare digital pin 13 to trigger the cooler
tempPin int = 0, / / ??Declare the analog pin 0 to read the value of the temperature sensor
valorSensorTemp int = 0 / / Variable used to read the temperature value
valorTemp int = INT_MAX / / Variable used to store the lowest temperature value

LiquidCrystal lcd (9, 8, 5, 4, 3, 2) / / Creates a LCD object and assign the pins

void setup () {

pinMode (fan, OUTPUT) / / Sets the pin 13 as output
lcd.begin (16, 2), / / ??Sets the display with 16 columns and 2 lines
}

void loop () {

/ * To avoid large variations in reading the component
LM35 6 are done reading is the lowest precedence value read * /

valorTemp = INT_MAX / / Initializing the variable with the largest possible int value
for (int i = 1; i <= 6; i + +) {/ / Reading the value of the temperature sensor

valorSensorTemp = analogRead (sensorTemp);

valorSensorTemp * = 0:54 / / Transforms the value read by the temperature sensor in degrees Celsius approximate

if (valorSensorTemp <valorTemp) {/ / Keeping always read the lowest temperature
valorTemp = valorSensorTemp;
}

delay (100);
}

if (valorTemp> 35) / / Indicates condition to drive the cooler
{
lcd.setCursor (0.1) / / Sets the column 0 and line 1 of the LCD which will print the string
lcd.write ("Fan connected!") / / Prints the LCD
digitalWrite (fan, HIGH) / / When true condition, connects the cooler
}
else
{
lcd.setCursor (0.1);
lcd.write ("Fan off");
digitalWrite (fan, LOW); / / Turns cooler when it is low the valorTemp, indicating that the LCD is off
}
delay (1000);

/ / Displaying the value of the temperature sensor reading on the LCD display
lcd.clear () / / Clears the LCD display
lcd.print ("Temperature:") / / Prints the string on the LCD display
lcd.print (valorTemp);
lcd.write (B11011111); / / Symbol degrees Celsius
lcd.print ("C");

delay (2000); / / Waits 2/2
}

 lcd.clear () / / Clears the LCD display

There.

(Did you notice the code tags, by the way?)

sensorTemp const int = 0 / / pin in which the analog temperature sensor is connected

And there.

Statements must be terminated by a semicolon. Many of yours are not.

What's the colon doing in this statement?
valorSensorTemp * = 0:54 / / Transforms the value read by the temperature sensor in degrees Celsius approximate

Hi and Thanks.

Are you saying that were you have suggested is wrong, if it is how do i correct it and with what?

Ray

You need to get an elementary textbook for the C and/or C++ language and study it. You cannot write random stuff and expect it to work. Computers don't care so much about spelling, but they are fussy about punctuation.

Are you saying that were you have suggested is wrong, if it is how do i correct it and with what?

Yes it is wrong. However until you say what you mean it to be no one can correct it because as it stands it is meaningless.

Read the how to use the forum sticky.
Correct your code to remove , from the end of statement lines and replace with ;
Post your code correctly this time, and we will take it from there.

Hi.

Many apologies if i am getting this all wrong, i should have said in my introduction i am a complete novice, electronics has it been a fascination of mine for many years, i took it up last year at the age of 64, when i retired, i am now 65, i spent all my whole working life as a Mechanical engineer, i know how to use a computer, i roughly know how they work, i know nothing about the language, so may i start again.

The sketch that i uploaded was cut and pasted from a Portuguese web site translated by Google, i tried to verify in the Arduino program an the original that's when i hit the problem, i have not written anything random at all to the sketch, it's as it is when i cut and pasted it.

The project is a Temperature controlled Cooling fan for an electronics cabinet, using an LM35 sensor and having a 2 line LCD displaying the actual Temperature, the idea is to keep the fan OFF until a Max temperature as been reached, the fan then turns ON, the fan turns OFF again when the lower set point as been reached. ie, Fan ON @ 37 Degrees C, Fan OFF @ 30 Degrees C.

I hope this all helps someone, any advice on how to learn to use Arduino properly would be greatly received.

Ray

The sketch that i uploaded was cut and pasted from a Portuguese web site translated by Google

That link would be useful.

The IDE comes with a lot of code examples.
Looking through these, modifying and expanding them is a useful learning activity.

I'd suggest you go back to the original sketch. It looks like the translation process has caused a lot of your problems. The sketch looks short enough that you should be able to translate the variable names manually, which will be a lot easier than fixing the odd changes that broke it.

The sketch that i uploaded was cut and pasted from a Portuguese web site translated by Google

So no chance of the code being corrupted is there. :slight_smile:
Best laugh I have had all week.

So yes post the link to the page.

However you are better off trying to learn the basics of programming before delving into your own projects. Why not get a good arduno introductory book.

Here's a version that compiles at least:

#include <LiquidCrystal.h>
#include <limits.h>

const int sensorTemp = 0; // pin in which the analog temperature sensor is connected

int fan = 13;             // declare digital pin 13 to trigger the cooler
int tempPin  = 0;         // ??Declare the analog pin 0 to read the value of the temperature sensor
int valorSensorTemp = 0;  // Variable used to read the temperature value
int valorTemp  = INT_MAX; // Variable used to store the lowest temperature value

LiquidCrystal lcd (9, 8, 5, 4, 3, 2); // Creates a LCD object and assign the pins

void setup () 
{
pinMode (fan, OUTPUT); // Sets the pin 13 as output
lcd.begin (16, 2); // ??Sets the display with 16 columns and 2 lines
}

void loop () 
{
/* To avoid large variations in reading the component
   LM35 6 are done reading is the lowest precedence value read */

valorTemp = INT_MAX; // Initializing the variable with the largest possible int value
for (int i = 1; i <= 6; i ++) 
  {// Reading the value of the temperature sensor
  valorSensorTemp = analogRead (sensorTemp); 
  valorSensorTemp *= 0.54; // Transforms the value read by the temperature sensor in degrees Celsius approximate

  if (valorSensorTemp <valorTemp)
    {// Keeping always read the lowest temperature
    valorTemp = valorSensorTemp;
    }
  delay (100);
  } 

if (valorTemp> 35) // Indicates condition to drive the cooler
  {
  lcd.setCursor (0,1); // Sets the column 0 and line 1 of the LCD which will print the string
  lcd.write ("Fan connected!"); // Prints the LCD
  digitalWrite (fan, HIGH); // When true condition, connects the cooler
  }
else
  {
  lcd.setCursor (0,1);
  lcd.write ("Fan off");
  digitalWrite (fan, LOW); // Turns cooler when it is low the valorTemp, indicating that the LCD is off
  }
delay (1000);

// Displaying the value of the temperature sensor reading on the LCD display
lcd.clear (); // Clears the LCD display   
lcd.print ("Temperature:"); // Prints the string on the LCD display               
lcd.print (valorTemp);
lcd.write (B11011111); // Symbol degrees Celsius
lcd.print ("C");
delay (2000); // Waits 2/2
}

Some of the comments still show their translated origin though

#include <LiquidCrystal.h>
#include <limits.h>

const byte tempSensorPin = 0; 
const byte fanPin = 13; 
const float CELSIUS_FACTOR = 0.54;
LiquidCrystal lcd (9, 8, 5, 4, 3, 2);

void setup () 
{
  pinMode (fanPin, OUTPUT);
  lcd.begin (16, 2);
}

void loop () 
{
  int minTemp = INT_MAX;
  for (int i = 0; i < 6; i++) 
  {
    int tempSensorVal = analogRead (tempSensorPin) * CELSIUS_FACTOR; 
   
    if (tempSensorVal < minTemp) {
      minTemp = tempSensorVal;
    }
 
    delay (100);
  } 
   
  lcd.setCursor (0, 1); 
  if (minTemp > 35) 
  {
      lcd.write ("Fan connected!");
      digitalWrite (fanPin, HIGH);
  }
  else
  {
      lcd.write ("Fan off");
      digitalWrite (fanPin, LOW);
  }
  delay (1000);
   
  lcd.clear (); 
  lcd.print ("Temperature:");
  lcd.print (minTemp);
  lcd.write (B11011111);
  lcd.print ("C");
 
  delay (2000);
}

It compiles, but that's the only warranty.

My hovercraft is full of eels

Many thanks to you all especially wild bill & awol the sketches work, i have a lot to learn.

Ray