Help fix my code PLEASE

I'm trying to attach a Myoware EMG sensor and I'm using this code to activate it. Whenever I try to run it, however, it gives me this error message:
Compilation error: Error: 2 UNKNOWN: exit status 1
Can anyone help me?
My code:
#include <Servo.h>
Servo myservo;
const int threshValue = 250;
void setup()
{
myServo.attatch(9);
}
void loop()
int value = analogRead(A3);
if(value < threshValue)
{
myServo.writeMicroseconds(800);
}
else
{
myServo.writeMicroseconds(2500);
}

Your code is incomplete.
void loop ()
{
....
....
}

You also spelled attach wrong.

Please remember to use code tags when posting code, and post ALL of the error messages

@cmherman74, your topic has been moved to a more suitable location on the forum.

Can you take a bit of time to read How to get the best out of this forum and next edit your post and apply to your post what you've read / learned about code tags. Thank you.

Your code corrected, formatted with the IDE auto format tool and posted properly in code tags (</>). See comments.

#include <Servo.h>

Servo myServo; // ******* changed from myservo
               // ******* C++ is case sensitive
const int threshValue = 250;

void setup()
{
   myServo.attach(9);  // ******* attatch bad spelling
}

void loop()
{ // *** added
   int value = analogRead(A3);
   if (value < threshValue)
   {
      myServo.writeMicroseconds(800);
   }
   else
   {
      myServo.writeMicroseconds(2500);
   }
} // *** added

Why are you using a beta version of the IDE; you will probably get more useful information from the IDE if you use the standard 1.8.x version.

// Edit
I've just installed the 2.0 Beta and forced an error in the bareminimum sketch; the output that I get

c:\Users\sterretje\AppData\Local\Temp\.arduinoIDE-unsaved2021521-1040-lvrli7.xtq5l\BareMinimum\BareMinimum.ino: In function 'void loop()':
c:\Users\sterretje\AppData\Local\Temp\.arduinoIDE-unsaved2021521-1040-lvrli7.xtq5l\BareMinimum\BareMinimum.ino:6:13: error: expected '}' at end of input
 void loop() {
             ^
Compilation error: Error: 2 UNKNOWN: exit status 1

So there is more info available.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.