user32991: I have a middle school student who is having problems getting her pollution sensor to work when asked to. I have attached her document to this post. Can anyone help her fix the issue?
int conductivitySensorValue; //initialize an integer variable to hold the sensor reading

void setup() {
Serial.begin(9600); //start serial communications so we can print the reading out

}

void loop() {
  conductivitySensorValue = analogRead(A0); //gat the integer representation of the sensor reading 

  float voltage = conductivitySensorValue*(5.0/1023.0); //put the data in terms of our voltage (5 volts)

  Serial.println("The Conductivity is" + voltage); //print the current reading to the serial port
}  


Arduino: 1.8.2 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Users\sushmit\Documents\Arduino\sketch_apr19a\sketch_apr19a.ino: In function 'void loop()':

sketch_apr19a:13: error: invalid operands of types 'const char [20]' and 'float' to binary 'operator+'

   Serial.println("The Conductivity is" + voltage); //print the current reading to the serial port

                                          ^

exit status 1
invalid operands of types 'const char [20]' and 'float' to binary 'operator+'

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

End copy.......

user4143: You can't add a string literal and a number together.
Instead you either have to convert one or both into a format that can be joined, or just treat them as separate entities. The simplest way is:
Serial.print(F("The Conductivity Is: "));
Serial.println(voltage).

Note the use of F(...) around the string literal - that forces it to stay in Flash so it doesn't waste RAM. Maybe not an issue with this project, but a good habit to get into nonetheless.

32991: <p>I have a middle school student who is having problems getting her pollution sensor to work when asked to. I have attached her document to this post. Can anyone help her fix the issue?</p>

<pre><code>int conductivitySensorValue; //initialize an integer variable to hold the sensor reading

void setup() {
Serial.begin(9600); //start serial communications so we can print the reading out

}

void loop() {
  conductivitySensorValue = analogRead(A0); //gat the integer representation of the sensor reading 

  float voltage = conductivitySensorValue*(5.0/1023.0); //put the data in terms of our voltage (5 volts)

  Serial.println("The Conductivity is" + voltage); //print the current reading to the serial port
}  


Arduino: 1.8.2 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Users\sushmit\Documents\Arduino\sketch_apr19a\sketch_apr19a.ino: In function 'void loop()':

sketch_apr19a:13: error: invalid operands of types 'const char [20]' and 'float' to binary 'operator+'

   Serial.println("The Conductivity is" + voltage); //print the current reading to the serial port

                                          ^

exit status 1
invalid operands of types 'const char [20]' and 'float' to binary 'operator+'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -&gt; Preferences.
</code></pre>

<p>End copy.......</p>
 4143: <p>You can't add a string literal and a number together.</p>

<p>Instead you either have to convert one or both into a format that can be joined, or just treat them as separate entities. The simplest way is:</p>

<pre><code>Serial.print(F("The Conductivity Is: "));
Serial.println(voltage).
</code></pre>

<p>Note the use of <code>F(...)</code> around the string literal - that forces it to stay in Flash so it doesn't waste RAM. Maybe not an issue with this project, but a good habit to get into nonetheless.</p>
