Прошу помощи разобраться.

Ahatolii
Offline
Зарегистрирован: 10.12.2017

Доброго втремени суток господа форумчане. Прошу помощи разобраться в этом проекте. Что то я ника не могу понять почему он не хочет компелироваться. 


/*
 * RCWController SAMPLE Program
 * ESP-WROOM-2 & WALLBOT
 * 2016/2/18 by Michio Ono
 * http://rcwcontroller.micutil.com
 */
 */ 

//For Debugging active flag and read out via serial:
//#define DEBUG

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>

#include <EEPROM.h>

WiFiServer server(80);

WiFiUDP Udp;

//client ssid and pw stored in EEPROM!
String ssid = "";  
String pass = "";

#define SssidAP "Z21_ESP"   // Default Z21 AP (SSID)
#define SpassAP "12345678"  // Default Z21 network password
#define SkanalAP 6          // Default Kanal des APSP          LPC1768
#define Left_PWM  12  // PIN4   <->   PIN21
#define Left_FWD  14  // PIN3   <->   
#define Left_REV  15  // PIN6   <->
#define Rght_PWM  13  // PIN5   <->   PIN22
#define Rght_FWD  4   // PIN10  <->
#define Rght_REV  5   // PIN14  <->
                      // PIN18  <->   PIN1 : GND
 
const char ssid[] = "ESP-WallBot";  //  your network SSID (name)
const char pass[] = "esp8266ap";  // your network password
 
WiFiUDP udp;
unsigned int localPort = 10000;
const int PACKET_SIZE = 256;
char packetBuffer[PACKET_SIZE];
int status = WL_IDLE_STATUS;
int prev_S=128;

Motor *left_track;
Motor *right_track;

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  WiFi.softAP(ssid, pass);
  IPAddress myIP = WiFi.softAPIP();

  Serial.print("AP IP address: ");
  Serial.println(myIP);
 
  Serial.println("Starting UDP");
  udp.begin(localPort);
  Serial.print("Local port: ");
  Serial.println(udp.localPort());

  left_track = new Motor(Left_PWM, Left_FWD, Left_REV);
  right_track = new Motor(Rght_PWM, Rght_FWD, Rght_REV);
  left_track->Stop();
  right_track->Stop();
}


void loop() {
  int rlen, val_V=0,val_S=128;
  
  while (1) {
    rlen = udp.parsePacket();
    if(rlen<10) {
      delay(1);
      continue;
    }
     
    udp.read(packetBuffer, (rlen > PACKET_SIZE) ? PACKET_SIZE : rlen);

    val_S=packetBuffer[5];
    if(val_S!=prev_S) {
      //Right analogue y-axis
      left_track->ChangeSpeed(val_S);
      right_track->ChangeSpeed(val_S);
      prev_S=val_S;
    }
    
    val_V=packetBuffer[1];
    if(val_V) {
      switch (val_V) {
        case 1://Left cross up
          left_track->ChangeDirection((boolean)FORWARD);
          right_track->ChangeDirection((boolean)FORWARD);
          break;
        case 2://Left cross down
          left_track->ChangeDirection((boolean)REVERSE);
          right_track->ChangeDirection((boolean)REVERSE);
          break;
        case 4://Left cross right
          left_track->ChangeDirection((boolean)REVERSE);
          right_track->ChangeDirection((boolean)FORWARD);
          break;
        case 8://Left cross right
          left_track->ChangeDirection((boolean)FORWARD);
          right_track->ChangeDirection((boolean)REVERSE);
          break;
      }
      left_track->Rotate();
      right_track->Rotate();
      
    } else {
      //Release button
      left_track->Stop();
      right_track->Stop();
      
    }
    /*
    for(int i=0;i<rlen;i++) {
      Serial.printf("%d",packetBuffer[i]);
    }
    Serial.printf("\n");
    */
    //delay(10);
  }
}
b707
Offline
Зарегистрирован: 26.05.2017

укажите ошибку компиляции.

Только пожалуйста. не в виде скриншота - просто скопируйте как текст и вставьте в сообщение.

Ahatolii
Offline
Зарегистрирован: 10.12.2017

Сам проект взят вот отсюда  https://www.youtube.com/watch?v=zo43jGfj1E0  это видео

                                            http://rcwcontroller.micutil.com/ это саит автора.

Sr.FatCat
Offline
Зарегистрирован: 19.02.2016

Как минимум, 22 и 23 строки - лишние

b707
Offline
Зарегистрирован: 26.05.2017

Ahatolii пишет:

Сам проект взят вот отсюда  https://www.youtube.com/watch?v=zo43jGfj1E0  это видео

                                            http://rcwcontroller.micutil.com/ это саит автора.

послушайте, вы читаете, что вам пишут? - ошибку компиляции укажите!

Чей это проект и кто автор - здесь никому не интересно. Если у вас претензии к автору скетче - ему и пишите.

Ahatolii
Offline
Зарегистрирован: 10.12.2017

Так вот еще раз новый скейч. (в том возможны поправки этот не копанный)

/*
 * RCWController SAMPLE Program
 * ESP-WROOM-2 & WALLBOT
 * 2016/2/18 by Michio Ono
 * http://rcwcontroller.micutil.com
 */
 
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include "TB6612FNG.h"
                      // ESP          LPC1768
#define Left_PWM  12  // PIN4   <->   PIN21
#define Left_FWD  14  // PIN3   <->   
#define Left_REV  15  // PIN6   <->
#define Rght_PWM  13  // PIN5   <->   PIN22
#define Rght_FWD  4   // PIN10  <->
#define Rght_REV  5   // PIN14  <->
                      // PIN18  <->   PIN1 : GND
 
const char ssid[] = "ESP-WallBot";  //  your network SSID (name)
const char pass[] = "esp8266ap";  // your network password
 
WiFiUDP udp;
unsigned int localPort = 10000;
const int PACKET_SIZE = 256;
char packetBuffer[PACKET_SIZE];
int status = WL_IDLE_STATUS;
int prev_S=128;

Motor *left_track;
Motor *right_track;

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  WiFi.softAP(ssid, pass);
  IPAddress myIP = WiFi.softAPIP();

  Serial.print("AP IP address: ");
  Serial.println(myIP);
 
  Serial.println("Starting UDP");
  udp.begin(localPort);
  Serial.print("Local port: ");
  Serial.println(udp.localPort());

  left_track = new Motor(Left_PWM, Left_FWD, Left_REV);
  right_track = new Motor(Rght_PWM, Rght_FWD, Rght_REV);
  left_track->Stop();
  right_track->Stop();
}


void loop() {
  int rlen, val_V=0,val_S=128;
  
  while (1) {
    rlen = udp.parsePacket();
    if(rlen<10) {
      delay(1);
      continue;
    }
     
    udp.read(packetBuffer, (rlen > PACKET_SIZE) ? PACKET_SIZE : rlen);

    val_S=packetBuffer[5];
    if(val_S!=prev_S) {
      //Right analogue y-axis
      left_track->ChangeSpeed(val_S);
      right_track->ChangeSpeed(val_S);
      prev_S=val_S;
    }
    
    val_V=packetBuffer[1];
    if(val_V) {
      switch (val_V) {
        case 1://Left cross up
          left_track->ChangeDirection((boolean)FORWARD);
          right_track->ChangeDirection((boolean)FORWARD);
          break;
        case 2://Left cross down
          left_track->ChangeDirection((boolean)REVERSE);
          right_track->ChangeDirection((boolean)REVERSE);
          break;
        case 4://Left cross right
          left_track->ChangeDirection((boolean)REVERSE);
          right_track->ChangeDirection((boolean)FORWARD);
          break;
        case 8://Left cross right
          left_track->ChangeDirection((boolean)FORWARD);
          right_track->ChangeDirection((boolean)REVERSE);
          break;
      }
      left_track->Rotate();
      right_track->Rotate();
      
    } else {
      //Release button
      left_track->Stop();
      right_track->Stop();
      
    }
    /*
    for(int i=0;i<rlen;i++) {
      Serial.printf("%d",packetBuffer[i]);
    }
    Serial.printf("\n");
    */
    //delay(10);
  }
}

 

поначалу ему не хватало библиотеки для компиляции "TB6612FNG.h"

я еедобавил в папку со скейчем, по другому он ее не видет. 

А теперь вот такая ошибка.

 

Esp8266_UDP_TB6612_Ex01:19: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:19: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:22: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:22: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:34: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:34: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:34: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:34: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:35: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:35: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:36: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:36: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:36: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:36: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:37: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:37: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:39: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:39: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:39: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:39: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:40: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:40: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:40: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:40: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:42: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:42: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:42: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:42: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:44: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:44: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:45: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:45: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:45: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:45: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:46: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:46: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:46: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:46: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:47: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:47: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:47: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:47: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:50: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:51: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:59: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:59: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:59: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:59: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:66: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:66: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:67: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:67: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:67: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:67: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:67: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:67: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:67: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:67: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:112: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:112: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:112: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:112: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:112: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:112: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:112: error: stray '\302' in program
 
Esp8266_UDP_TB6612_Ex01:112: error: stray '\240' in program
 
Esp8266_UDP_TB6612_Ex01:30: error: 'Motor' does not name a type
 
Esp8266_UDP_TB6612_Ex01:31: error: 'Motor' does not name a type
 
C:\Users\Анатолий\Desktop\Esp8266_UDP_TB6612_Ex01\Esp8266_UDP_TB6612_Ex01.ino: In function 'void setup()':
 
Esp8266_UDP_TB6612_Ex01:50: error: 'left_track' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:50: error: expected type-specifier before 'Motor'
 
Esp8266_UDP_TB6612_Ex01:50: error: expected ';' before 'Motor'
 
Esp8266_UDP_TB6612_Ex01:51: error: 'right_track' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:51: error: expected type-specifier before 'Motor'
 
Esp8266_UDP_TB6612_Ex01:51: error: expected ';' before 'Motor'
 
C:\Users\Анатолий\Desktop\Esp8266_UDP_TB6612_Ex01\Esp8266_UDP_TB6612_Ex01.ino: In function 'void loop()':
 
Esp8266_UDP_TB6612_Ex01:72: error: 'left_track' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:73: error: 'right_track' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:81: error: 'left_track' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:81: error: 'FORWARD' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:82: error: 'right_track' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:85: error: 'REVERSE' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:97: error: 'left_track' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:98: error: 'right_track' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:102: error: 'left_track' was not declared in this scope
 
Esp8266_UDP_TB6612_Ex01:103: error: 'right_track' was not declared in this scope
 
exit status 1
stray '\302' in program
 
b707
Offline
Зарегистрирован: 26.05.2017

Esp8266_UDP_TB6612_Ex01:19: error: stray '\302' in program

такая ошибка возникает, если вы скопировали скетч из интернета как HTML, а не как текст.

Ahatolii
Offline
Зарегистрирован: 10.12.2017

Нет там у автора кнопка есть. Он копируется архивом в нем две папки для windows и ios

 

kalapanga
Offline
Зарегистрирован: 23.10.2016

Ahatolii пишет:

Нет там у автора кнопка есть. Он копируется архивом в нем две папки для windows и ios

Ну значит в архиве так лежит. Но Вам совершенно чётко пишут - в строках непонятные символы.

Можете даже в Word скетч открыть, включить отображение непечатаемых символов и Вы их все увидите. Концы строк естественно нужны, а остальное - мусор.

Ahatolii
Offline
Зарегистрирован: 10.12.2017

Понял спасибо.