EEG y servo [SOLUCIONADO]

Hola, soy nuevo en arduino y necesito ver si me pueden ayudar a hacer un codigo, tengo un sensor EEG TGAM y queria conectarlo a un arduino para que al concentrar se accione un servo y del desconcentrar el servo vuelva a su estado inicial, me diran buscar el google pues no encontre ningun codigo para hacer funcionar el servo con el EEG, solo encontre un codigo de led tipo vumetro y no tengo idea de como modificarlo.

La idea es armar una mano (protesis) para un niño de aca de mi zona y donarcela a la familia ya que es de bajo recursos, ya tengo el arduino nano, mano hecha en impresora 3D , mini servo y el sensor EEG, si alguien me puede dar una mano muy agradecido, pido ayuda porque yo no lo se hacer

Bien, yo te ayudo.
Dime sin pensar en código, que niveles EEG serás los que mueva el servo.
Exprésalo asi.. de tal equivalencia leida sera tal movimiento del servo.

Si te voy a ayudar también ayúdame a mi.

Lee las normas del foro y cúanto enlace pegues hazlo usando el tag de enlace correspondiente indicado por las Normas del Foro.
El servo tiene movimientos de 0 a X grados
Tu me respondes mas o menos un nivel de 60.
Con 60 que hago? Por favor se mas específico!!

Ahora si.
Que pasó con los enlaces que ahora los busco y no están!!
No dije que los borraras dije que los pusieras con tag de enlace, (eslabón).

Primer intento:

////////////////////////////////////////////////////////////////////////
// Arduino Bluetooth Interface with Mindwave
//
// This is example code provided by NeuroSky, Inc. and is provided
// license free.
////////////////////////////////////////////////////////////////////////
 
#include <Servo.h>

Servo myservo;  // create servo object to control a servo

#define LED           13
#define SERVOPIN       9
#define BAUDRATE      57600
#define DEBUGOUTPUT   0
 
#define powercontrol  10
 
// checksum variables
byte generatedChecksum  = 0;
byte checksum           = 0;
int payloadLength       = 0;
byte payloadData[64]    = {0};
byte poorQuality        = 0;
byte attention          = 0;
byte meditation         = 0;
 
// system variables
long lastReceivedPacket = 0;
boolean bigPacket = false;
byte pos, posAnt = 0;
 
//////////////////////////
// Microprocessor Setup //
//////////////////////////
void setup() {
  pinMode(LED, OUTPUT);
  Serial.begin(BAUDRATE);           // USB
  myservo.attach(SERVOPIN);  // attaches the servo on pin 9 to the servo object
}
 
////////////////////////////////
// Read data from Serial UART //
////////////////////////////////
byte ReadOneByte() {
  int ByteRead;
  while(!Serial.available());
  ByteRead = Serial.read();
 
#if DEBUGOUTPUT 
  Serial.print((char)ByteRead);   // echo the same byte out the USB serial (for debug purposes)
#endif
 
  return ByteRead;
}
 
/////////////
//MAIN LOOP//
/////////////
void loop() {
  // Look for sync bytes
  if (ReadOneByte() == 170)  {
    if(ReadOneByte() == 170)    {
        payloadLength = ReadOneByte();
     
        if (payloadLength > 169)          //Payload length can not be greater than 169
            return;
        generatedChecksum = 0;       
        for (int i = 0; i < payloadLength; i++) { 
             payloadData[i] = ReadOneByte();            //Read payload into memory
             generatedChecksum += payloadData[i];
        }  
 
        checksum = ReadOneByte();         //Read checksum byte from stream     
        generatedChecksum = 255 - generatedChecksum;   //Take one's compliment of generated checksum
 
        if(checksum == generatedChecksum)  {   
          poorQuality = 200;
          attention = 0;
          meditation = 0;
 
          for(int i = 0; i < payloadLength; i++)  {                                          // Parse the payload
          switch (payloadData[i]) {
          case 2:
                  i++;           
                  poorQuality = payloadData[i];
                  bigPacket = true;           
                  break;
          case 4:
                  i++;
                  attention = payloadData[i];                       
                  break;
          case 5:
                  i++;
                  meditation = payloadData[i];
                  break;
          case 0x80:
                  i = i + 3;
                  break;
          case 0x83:
                  i = i + 25;     
                  break;
          default:
                  break;
          } // switch
        } // for loop
 
#if !DEBUGOUTPUT
 
        // *** Add your code here ***
 
        if (bigPacket)   {
            if (poorQuality == 0)
               digitalWrite(LED, HIGH);
            else
               digitalWrite(LED, LOW);
           
            Serial.print("PoorQuality: ");
            Serial.print(poorQuality, DEC);
            Serial.print(" Attention: ");
            Serial.print(attention, DEC);
            Serial.print(" Time since last packet: ");
            Serial.print(millis() - lastReceivedPacket, DEC);
            lastReceivedPacket = millis();
            Serial.print("\n");
            
            if (attention > 60)   // aca esperamos nivel de atención > 60
               pos = 180;         // si es VERDADERO giro 180
            else 
               pos = 0;           // si no vuelvo.
            if (pos != posAnt)
                servo.write(pos)  // solo muevo si hay cambios.
            posAnt = pos;
        }
#endif       
        bigPacket = false;       
      }
      else {
        // Checksum Error
      }  // end if else for checksum
    } // end if read 0xAA byte
  } // end if read 0xAA byte
}

Vaya hombre.. y cual es el error!!!
Los errores los posteas usando tag de códigos.

Corrige esto

servo.write(pos);

agrega el ; al final

perdona.. me confundí

myservo.write(pos);