multiple "expected constructor, destructor, or type conversion before '(' token"

hi all,
i’m new to Arduino and am trying to connect a Ds18B20 temp sensor and an RGB led to change colors according to temperature. I am using a Moteino (set up on Arduino as Arduino Uno) and a Mac OS. I was able to successfully create both codes but it has proved difficult for me to connect them. any help would be so greatly appreciated!

I have received errors for “expected constructor, destructor, or type conversion before ‘(’ token” in lines 11, 12, 13, and 21 (and also others, including "combo_new:16: error: ‘Serial’ does not name a type
combo_new:18: error: expected initializer before ‘.’ token
combo_new:20: error: ‘sensors’ does not name a type combo_new:21: error: expected declaration before ‘}’ token).
(yes, it’s loaded with errors, but i’m new and still learning.)

as I have said, I’m new to arduino and since the internet hasn’t helped me figure out things and I haven’t done it on my own, I was hoping that some could give me tips. thank you so much!

combo_new.ino (2.08 KB)

I was hoping that some could give me tips

Post your code, don’t attach it - it’s hard to read attachments on mobile devices.

#include <OneWire.h>
#include <DallasTemperature.h>
DallasTemperature sensors(OneWire);
DeviceAddress thermometer = {0x28, 0xDD, 0x43, 0x5C, 0x06, 0x00, 0x00, 0x2C};
int redPin = 11;
int greenPin = 10;
int bluePin = 9;

void setup ();

pinMode (redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);

// start serial port
Serial.begin(9600);
// Start up the library
DallasTemperature sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(thermometer, 10);
}
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print(“Error getting temperature”);
} else {
Serial.print("C: “);
Serial.print(tempC);
Serial.print(” F: ");
Serial.print(DallasTemperature::toFahrenheit(tempC));
}

void loop()
{
delay(2000);
Serial.print(“Getting temperatures…\n\r”);
sensors.requestTemperatures();

Serial.print(“temperature is: “);
printTemperature(thermometer);
Serial.print(”\n\r”);
}

{
void setColor(int red, int green, int blue)

{
#ifdef COMMON_ANODE
red = 255 - red;
green = 255 - green;
blue = 255 - blue;
#endif
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}

{
setColor(255, 0, 0); // red 1
delay(1000);
setColor(240, 3, 32); // red 2
delay(1000);
setColor(225, 6, 64); // red 3
delay(1000);
setColor(210, 9, 96); // red 4
delay(1000);
setColor(195, 12, 128); // red 5
delay(1000);
setColor(180, 15, 160); // red 6
delay(1000);
setColor(165, 18, 192); // red 7
delay(1000);
setColor(150, 21, 224); // red 8
delay(1000);
setColor(135, 25, 255); // red 9
delay(1000);
}

{
if Temperature<-10
setColor(255, 0, 0); // red 1
delay(1000);
}

{
if -10<Temperature<0
setColor(240, 3, 32); // red 2
delay(1000);
}

{
if 0<Temperature<10
setColor(225, 6, 64); // red 3
delay(1000);
}

{
if 10<Temperature<20
setColor(210, 9, 96); // red 4
delay(1000);
}

{
if 20<Temperature<30
setColor(195, 12, 128); // red 5
delay(1000);
}

{
if 30<Temperature<40
setColor(180, 15, 160); // red 6
delay(1000);
}

{
if 40<Temperature<50
setColor(165, 18, 192); // red 7
delay(1000);
}

{
if 50<Temperature<60
setColor(150, 21, 224); // red 8
delay(1000);
}

{
if Temperature>60
setColor(135, 25, 255); // red 9
delay(1000);
}

  if Temperature<-10

Please take a look at some of the examples of sketches provided with the IDE, and see how an “if” is constructed.

You’ve got braces where braces shouldn’t be - you really need to start with some basics.

And code tags - we really like code tags.

@viviankim: Please edit your post, select the code, and put it between [code][/code] tags.

You can do that by hitting the “Code” icon above the posting area. It is the first icon, with the symbol: </>