help w/compiler error msg.

I’m 100% newbie at this so would a kind soul point me in the right direction?
I’m trying to compile a little code and I keep geting an error msg" expected primary-expression before else" but I just cant see it .
here is the code:

int ledPin=13;
int analogPin=3;
int val=0;
int threshold=156;

void setup()

void loop()

if (val<=threshold);{


Eventualy I would like to use this to control temp of a beer mash set up…

thakx for any help…

I bet you just didn’t notice the semicolon on the line with the if statement.

I like to put spaces inside and after parentheses to make typos like that easier to catch.

int ledPin = 13;
int analogPin = 3;
int val = 0;
int threshold = 156;
void setup() {
  pinMode( ledPin, OUTPUT );
void loop() {
  val = analogRead( analogPin );

  if( val <= threshold ) {
    digitalWrite( ledPin, HIGH );
  } else {
    digitalWrite( ledPin, LOW );

Now I see it!...Thanks. Now we go for the timming loop... BTW can the arduino board work two loops at once? Like check temps "n"times during "n"minutes?

I think you mean nested loops, which may look like this:

#define N_TIMES 10
#define N_MINUTES 5

// 1 MINUTE == 60s == 60000ms
#define MINUTE 60000

void setup() {

void loop() {
   for( int i = 0; i < N_TIMES ; i++ ) {
   delay( N_MINUTES );

That will execute doSomething() 10 times, wait 1 minute, then repeat. There is one loop ( the for-loop ) “nested” inside of another ( the Arduino running the loop() function indefinitely ).

If you’re wondering if the Arduino can execute two separate loops simultaneously (synchronously), then the answer is no. As far as I know, the ATmega8/168 is not capable of parallel processing ( “dual core” ).

I’ve never actually written anything in Processing, so there may be other conventions, but this is how it’s done in most modern languages.