Hello everyone,
I am creating a project to get more familiar with coding and Arduinos. I am pretty new to it all, so bare with me. I am about 1/4 finished with what I am trying to accomplish. I stopped to verify the code and received this error:
a function-definition is not allowed here before '{' token {
I can't figure out why I am getting the error on the void loop() { line.
//define pins for RGB LED
const int redLEDpin = 9;
const int blueLEDpin = 10;
const int greenLEDpin = 11;//define temp sensor pin and a baseline temperature (degrees C) to start with
const int tempSensPin = A0;
const float baselineTemp = 20.0;void setup()
{
//initiate serial monitor
Serial.begin(9600);//declare the red, blue, and green LED pins as outputs and shut them off
for(int pinNumber = 9; pinNumber < 12; pinNumber++)
{
pinMode(pinNumber, OUTPUT);
digitalWrite(pinNumber, LOW);
{
}void loop()
{
//declare var to read tempSenPin Value
int sensorVal = analogRead(tempSensPin);//display tempSensPin readings on serial monitor
Serial.print("Sensor Value: ");
Serial.print(sensorVal);
Serial.print(" ");//convert the output of tempSensPin to voltage
float voltage = (sensorVal / 1024.0) * 5.0;//display the voltage on serial monitor
Serial.print("Voltage: ")
Serial.print(voltage);
Serial.print(" ");//convert voltage to temperature (degrees C)
float temperatureC = (voltage - 0.5) * 100;//display temerpatureC on serial monitor
Serial.print("Degrees Celsius: ");
Serial.print(temperatureC);
Serial.print(" ");//convert degrees Celsius to degrees Fahrenheit
float temperatureF = (temperatureC * 9 / 5) + 32;//display temperatureF on serial monitor
Serial.print("Degrees Fahrenheit: ");
Serial.println(temperatureF);//add 5 second delay for easy reading on serial monitor
delay(5000);
}