Hi all,
I'm currently trying to upload the code shown below to my Arduino board:
/* LED pin is pin 13 on Arduino UNO R3 */
#define ledpin 13
int DS18B20_int; // DS18B20 measurements in integer
float DS18B20_01; // DS18B20 measurements in float
/* void setup allows to run once */
void setup()
{
/* Start serial port to display results on screen */
Serial.begin (9600);
Serial.println ("Serial Monitor Connected");
pinMode (ledpin, OUTPUT); // Make pin 13 output for LED
/* void setup allows to run once */
void loop(){
int incoming = Serial.available();
if (incoming > 0)
{
DS18B20_int = Serial.parseInt(); // Read integers as integers instead of ASCII
// anything else returns 0
DS18B20_01 = (DS18B20_int/10.0); // Divide integer value by 10 to convert to float
/* Print temperature measurement from Arduino Uno 01 as decimal (float) */
Serial.print ("Temperature value from DS18B20 Sensor: ");
Serial.print (DS18B20_01,1);
Serial.println (" *C");
led ();
}
}
/******************* LED Configuration *******************/
void led () {
digitalWrite(ledpin, HIGH); // LED on
delay(500);
digitalWrite(ledpin, LOW); // LED off
}
/*******************************************************************/
I keep on getting an error saying
"exit status 1
a function-definition is not allowed here before '{' token"
token for this line of the code:
void loop(){