Newby cannot get blink to work. Please help!

My project is to use the Makeblock Ultimate 2.0 robot kit to create a balancing robot that is controlled wirelessly by a Nintendo Wii nunchuck starting from the firmware. The 3,000 lines of code is so complicated and involved that it is hard to understand. I have progressed to the point that I have what I think of as a vibration(timing) problem. So, I am ready to move on from the Arduino IDE to something that can give me more information and help. So, I installed Visual Studio Code and the Arduino extension. But with Blink I cannot get past a "Serial.print" error. Literature says that the PlatformIO extensionis better than the Arduino extension. So, I installed it and am following the instructions in the User guide.

https://docs.platformio.org/en/latest/ide/vscode.html#user-guide

But, I get the following error. I do not see a solution.

#include <Arduino.h>
    void setup() {
    // put your setup code here, to run once:
    }
    void loop() {
    // put your main code here, to run repeatedly:
    }

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (C:\Users\CL Plane Guy 3\Documents\PlatformIO\Projects\PlatformIO first project\src\main.cpp) will be provided by the Tag Parser.

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (C:\Users\CL Plane Guy 3\Documents\PlatformIO\Projects\PlatformIO first project\src\main.cpp) will be provided by the Tag Parser.

cannot open source file "stdlib.h" (dependency of "Arduino.h")

When I go to the includePath, it says not to edit(?).

Commit: 05f146c7a8f7f78e80261aa3b2a2e642586f9eb3

Date: 2019-03-08T00:51:49.278Z

Electron: 3.1.3

Chrome: 66.0.3359.181

Node.js: 10.2.0

V8: 6.6.346.32

OS: Windows_NT x64 6.1.7601

I cannot see a Serial.print() reference in the code below

Also this code is double?

Maybe the Arduino extension conflicts with the PlatformIO extension, uninstall it?

You might want to try to execute the “Rebuild Intellisense index” (see Redirecting...)

Also what’s your full platformio.ini?

Before I was studying the Arduino extension without success. I have left it and the

Serial.print();

command behind.

Now I am working on and with the PlatformIO extension for four days. For four days I have not gotten a response by other methods. This forum seems to be different. Your instantaneous response surprised me.

Yes, I have gotten a notice that the Arduino extension and the PlatformIO extension clash at Intellisense. So, the Arduino extension is disabled. I compose my posts in word. Sometimes the copy past has unexpected results. And your forum editor is new for me. Also, PlatformIO does not run the Arduino INO files. An

#include <Arduino.h>

must be inserted. What I cannot explain is why the dependencies for Arduino.h are not found.

I would like to "Rebuild Intellisense index" but I cannot find the command.

The platformion.ini should not need all this

; PlatformIO Project Configuration File
;
; Build options: build flags, source filter, extra scripting
; Upload options: custom port, speed and extra flags
; Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; Redirecting...
[env:lightblue-bean]
platform = atmelavr
framework = arduino
board = lightblue-bean
[env:bluefruitmicro]
platform = atmelavr
framework = arduino
board = bluefruitmicro
build_flags = -D LED_BUILTIN=1
[env:digispark-pro]
platform = atmelavr
framework = arduino
board = digispark-pro
build_flags = -D LED_BUILTIN=1
[env:digispark-pro32]
platform = atmelavr
framework = arduino
board = digispark-pro32
build_flags = -D LED_BUILTIN=1
[env:digispark-pro64]
platform = atmelavr
framework = arduino
board = digispark-pro64
build_flags = -D LED_BUILTIN=1
[env:pro8MHzatmega328]
platform = atmelavr
framework = arduino
board = pro8MHzatmega328
[env:engduinov3]
platform = atmelavr
framework = arduino
board = engduinov3
[env:ethernet]
platform = atmelavr
framework = arduino
board = ethernet
[env:feather32u4]
platform = atmelavr
framework = arduino
board = feather32u4
build_flags = -D LED_BUILTIN=13
[env:flora8]
platform = atmelavr
framework = arduino
board = flora8
build_flags = -D LED_BUILTIN=1
[env:leonardo]
platform = atmelavr
framework = arduino
board = leonardo
[env:megaatmega2560]
platform = atmelavr
framework = arduino
board = megaatmega2560
[env:micro]
platform = atmelavr
framework = arduino
board = micro
[env:mightycore1284]
platform = atmelavr
framework = arduino
board = mightycore1284
[env:moteinomega]
platform = atmelavr
framework = arduino
board = moteinomega
[env:panStampAVR]
platform = atmelavr
framework = arduino
board = panStampAVR
build_flags = -D LED_BUILTIN=13
[env:quirkbot]
platform = atmelavr
framework = arduino
board = quirkbot
[env:reprap_rambo]
platform = atmelavr
framework = arduino
board = reprap_rambo
[env:robotControl]
platform = atmelavr
framework = arduino
board = robotControl
build_flags = -D LED_BUILTIN=13
[env:robotMotor]
platform = atmelavr
framework = arduino
board = robotMotor
build_flags = -D LED_BUILTIN=13
[env:sanguino_atmega1284p]
platform = atmelavr
framework = arduino
board = sanguino_atmega1284p
[env:sparkfun promicro16]
platform = atmelavr
framework = arduino
board = sparkfun_promicro16
[env:uno]
platform = atmelavr
framework = arduino
board = uno
[env:gemma]
platform = atmelavr
framework = arduino
board = gemma
build_flags = -D LED_BUILTIN=13
[env:attiny24]
platform = atmelavr
framework = arduino
board = attiny24
build_flags = -D LED_BUILTIN=13
[env:wildfirev3]
platform = atmelavr
framework = arduino
board = wildfirev3
[env:yun]
platform = atmelavr
framework = arduino
board = yun
[env:atmega328pb]
platform = atmelavr
framework = arduino
board = atmega328pb

Lets start with the basics - you said you want to get a

Makeblock Ultimate 2.0 robot kit

working… so what is the controller for that? It looks to be a custom version of the Arduino Mega board…

MegaPi is small but powerful mainboard based on Arduino MEGA 2560.

So to get started, you should only need the board definition for the Arduino Mega 2560 in your platformio.ini, not the dozen or so different board environments you have configured!! I looked at the boards search page, put mega 2560 into the search and had at look at the documentation for that specific board. Based on the info on that page, replacing what you currently have in your platformsio.ini file with the following …

[env:megaPi]
platform = atmelavr
board = megaatmega2560
framework = arduino

… will give you just one build environment, called megaPi, configured for the mega2560 board time, to be programmed using the arduino framework.

Then, since platformIO can be used to program many different board types, and with more than just the arduino programming language, we #include <Arduino.h> so that the special Arduino stuff is included.

A simple blink sketch such as the following should then build fine, but you may have to configure your upload port for it to upload properly. We’ll deal with that problem if you encounter it.

#include <Arduino.h>

void setup()
{
   digitalWrite(13, OUTPUT);
}

void loop()
{
   digitalWrite(13, HIGH);
   delay(1000);
   digitalWrite(13, LOW);
   delay(1000);
}
1 Like

Yes. This robot board is mainly a motor controller. You might call it a custom board. Although each/all boards can be called custom. It seems to pretend/program as if it is a standard/clone Arduino Mega 2560 as follows . . .

● Microcontroller: ATMEGA2560-16AU

● Input Voltage: DC 6V-12V

● Operating Voltage: DC 5V

● I/O Pins: 43

● Serial Ports: 3

● I2C Interface: 1

● SPI Interface: 1

● Analog Input Pins: 15

● DC Current per I/O Pin: 20mA

● Flash Memory: 256KB

● SRAM: 8KB

● EEPROM: 4KB

● Clock Speed: 16 MHz

● Dimension: 85*63mm

image.png

That is the board that I choose/chose. Although that may have been the Arduino extension. I have gone back into Visual Studio Code and the PlatformIO extension to find that the commands are mostly at the bottom of the screen.

Although I doubt that I should have to manually type the PlatformIO.ini file.

PlatformIO Project Configuration File

;

;   Build options: build flags, source filter, extra scripting

;   Upload options: custom port, speed and extra flags

;   Library options: dependencies, extra library storages

;

; Please visit documentation for the other options and examples

; http://docs.platformio.org/page/projectconf.html

 

[env:megaatmega2560]

platform = atmelavr

framework = arduino

board = megaatmega2560

And the communication port (COM6) has never been in question.

PS This post looks fine in email. I wonder how it will look on the forum.
It did not get here by email. So I am resubmitting it from the forum.

Let me go back to the beginning. I am trying to move on from the Arduino IDE. While in Visual Studio Code, a PROGRAM.ino file listing has SERIAL underlined with a red squiggle. I get the message . . .

"C/C++ IntelliSense service does not support .INO files. It might lead to the spurious problems with code completion, linting, and debugging. Please convert .INO sketch into the valid .CPP file."

And indeed, if I run such a program, it does in fact run fine.

To accomplish the conversion, I can and have save/d from Visual Studio Code into a CPP format. But then when I go back to the finder to look at the file it shows as still being an INO file. I can change the name of the file. I can save into a CPP format.

But, do I need the finder to call it a CPP file and how do I do that?

Okay, so what files do you have in the src/ directory now and what’s your current platformio.ini? Have you executed an intellisense rebuild as I have referenced above?

Arduino format is so much like CPP format that there is room for confusion. So, I resaved WiiAccessory.ino as a Closure document and then resaved again as a CPP document. I now have an original INO file in three(3) formats(INO, Closure and CPP). I do not anymore get the error message . . .

“C/C++ IntelliSense service does not support .INO files. It might lead to the spurious problems with code completion, linting, and debugging. Please convert .INO sketch into the valid .CPP file.”

The platformio.ini is . . .

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter, extra scripting
;   Upload options: custom port, speed and extra flags
;   Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html

[env:megaatmega2560]
platform = atmelavr
framework = arduino
board = megaatmega2560

I have done

Rebuld IntelliSense Index
Update project Libraries

My file structure is as follows . . .

> OPEN EDITORS
>   Interactive Playground
>   c_cpp_properties.json
>   PIO Home
>   WiiAccessory.cpp
> 
> VISUAL STUDIO WORKSPAVE (WORKSPACE)
>   |-WiiAccessory
>     |-.vscode
>     |-WiiAccessory.ino
>   |-Me_(2CScanTest
>   |-190312-092555-megaatmega2560
>   |-190312-02626-arduino-blink
>     |-.pioenvs
>     |-.piolibdeps
>     |-.vscode
>     |-include
>     |-lib
>     |-src
>       |-Blink.cpp
>     |-test
>       |-README
>     |-.gitignore
>     |-.travis.yml
>     |-platformio.ini
>     |-README.rst

Note that in WiiAccessory.cpp(originally .ino) has “Serial” underlined with a red squiggle and does not seem to work correctly. “Blink.cpp” (imported as .cpp) has “#include <Arduino.h>” underlined with a green squiggle and runs fine.

Within the workspace, you have four project folders - WiiAccessory, Me_(2CScanTest, 190312-092555-megaatmega2560, and 190312-02626-arduino-blink. 190312-02626-arduino-blink is the only valid one for bulding with platformio as it is the only one with a correct folder structure and platformio.ini file.

With regard to

Although I doubt that I should have to manually type the PlatformIO.ini file.

… this is indeed the case if you have already created a project, or wish to add another board type to an existing project. This is part of the whole reason the PlatformIO.ini file exists. If you were instead to use the ‘New Project’ option on the PIO Home screen, you would be able to simply give the project a name and choose your board from the list, and PIO would generate the platformio.ini entries for you. But again, as soon as you want to change that, or add more boards, you would have to edit the platformio.ini file.

Arduino format is so much like CPP format that there is room for confusion.

Yes, they are very similar, as the Arduino ‘language’ is based on the C++ standard, with helper functions, and some wrapper code that means you don’t need declare functions before using them. However, the actual file format is the same - they are plain text files. The only thing you needed to do was change the file extension from .ino to .cpp - i.e. right click on it in the file explorer, and choose rename. image

So by

Please convert .INO sketch into the valid .CPP file.

It is meant that you would (per the FAQ):

  1. Rename the file so it has a .cpp file extension
  2. Add #include <Arduino.h>
  3. If you have any functions in your code, either ensure they are declared before your setup and loop or add function prototypes before setup and loop.

Thank you for your comment.

Please know that I am reading everything I can find on PlatformIO.

190312-02626-arduino-blink is the only valid one

First. You cannot know that. My posted list was manually typed in with shortcuts. While I can find a command to "Collapse all" folders, I do not see a command to open all folders. And the list with all folders open would be quite long. For this learning process, I am focusing on just two(2) programs.

The workspace has four project folders
WiiAccessory
Me_I2CScanTest
190312-092555-megaatmega2560
190312-02626-arduino-blink

WiiAccessory folder (WiiAccessory.ino) is from the Arduino IDE and includes .vscode (arduino.json, c_cpp_properties.json), WiiAccessory.ino. It does not seem to be fully developed as it does not include a lot of Platform information. In spite of this I have been complaining that the Intellisense was not working properly. No more. It is deleted.

Me_I2CScanTest folder (Me_I2CSanTest.ino) is from the Arduino IDE and includes .vscode (arduino.json, c_cpp_properties.json), Me_I2CSanTest.ino. It does not seem to be fully developed as it does not include a lot of Platform information. I have put it behind me. It is deleted.

190312-092555-megaatmega2560 (Blink.ini) Does seem to be a fully developed PlatformIO project but is in .ini form. Deleted.

190312-02626-arduino-blink (Blink.cpp) this leaves the workspace with only one project (folder): 190312-02626-arduino-blink.

My file structure is as follows . . .(Short list)

    >     > OPEN EDITORS
    >     > VISUAL STUDIO WORKSPAVE (WORKSPACE)
    >     >       |-190312-02626-arduino-blink
    >     >       |-.pioenv
    >     >       |-.piolibdeps
    >     >       |-.vscode
    >     >       |-includ
    >     >       |-lib
    >     >       |-src
    >     >         |-Blink.cpp
    >     >       |-test
    >     >         |-README
    >     >       |-.gitignore
    >     >       |-.travis.yml
    >     >       |-platformio.ini
    >     >       |-README.rst

. . . i.e. right click on it in the file explorer, . . .

Thank you for that. It gives me another menu to work with.

"Please convert .INO sketch into the valid .CPP file."

This seems like a direct quote. But I cannot find that text in the FAQ.

I have used my new knowledge to push forward back to my project. It is a running program in the Arduino IDE. When I first imported it into PlatformIO it had 66 errors. Now with new knowledge, I have started over and have only 3 errors.

I have unfound dependencies. They are on the hard drive although they are deep in the folders. I thought that “c_cpp_properties.json” would find them. It did not. I have tried to put a path to the unfound libraries into “c_cpp_properties.json – browse” only to have them overwritten. For eeprom, there are two versions in three locations. Arduino has a 9KB version and makeblock has a 26KB version. PlatformIO uses the 9KB version.

image

C:\Program Files (x86)\Arduino\hardware\tools\                 avr\avr\include\avr\eeprom     9KB
C:\Program Files (x86)\mBlock\Arduino\hardware\tools\          avr\avr\include\avr\eeprom    26KB
C:\Users\CL Plane Guy 3\.platformio\packages\toolchain-atmel   avr\avr\include\avr\eeprom   9KB

What do I do?

My earlier response was based on the information given, nothing more, nothing less. I didn’t realise you had omitted some of the information. However, if the platformio.ino file is missing, it is not a platformio compatible project, and platformio will not work.

er… it’s from the message you see when you try to add / open an arduino sketch containing a .ino file?

image

As far as the included libraries, you may have some trouble if the mBlock folks have modified the stock standard Arduino libraries for their own purposes. You may be able to use the lib_extra_dirs option in platformio.ini to configure C:\Program Files (x86)\mBlock\Arduino\hardware\tools\ as a path, but I don’t know if that is the best option there. But these were just warnings weren’t they, not actual compile errors that stopped the firmware being built? Warnings like that are normal, and in fact the Arduino IDE is actually configured to hide most of them by default, so that you won’t see them.

Ok, after a little more looking, you should be using the MakeBlockDrive library developed by MakeBlock for their devices and as you can clearly see from the the list of includes there, they are including a custom EEPROM library, called MeEEPROM, etc. etc.

Get that library installed (add lib_deps = MakeBlockDrive to your platformio.ini file) and try copying the firmware_for_megaPi into your blink.cpp file. But before you try to build it, you will need to declare the function prototypes otherwise you will get build errors. Basically, I just put in at around line 251 (just before the first of the functions was implemented) the following block, and that will make the compiler happy when it’s trying to link everything together. Note that there may be a scollbar on the side of the list because there are a lot of functions!

void Backward();
void BackwardAndTurnLeft();
void BackwardAndTurnRight();
void ChangeSpeed(int16_t spd);
void Forward();
void IrProcess();
void PID_angle_compute();
void PID_speed_compute();
void Stop();
void TurnLeft();
void TurnLeft1();
void TurnRight();
void TurnRight1();
void WriteBalancedDataToEEPROM();
void WriteMegapiModeToEEPROM();
void balanced_model();
void callOK();
void encoder_move_finish_callback(int slot,int extId);
void initStepper(uint8_t index,int16_t maxSpeed);
void isr_process_encoder1();
void isr_process_encoder2();
void isr_process_encoder3();
void isr_process_encoder4();
void line_model();
void parseCmd(char * cmd);
void parseData();
void parseGcode(char * cmd);
uint8_t readBuffer(int16_t index);
void readEEPROM();
float readFloat(int16_t idx);
long readLong(int16_t idx);
void readSensor(uint8_t device);
void readSerial();
int16_t readShort(int16_t idx);
char* readString(int16_t idx,int16_t len);
uint8_t* readUint8(int16_t idx,int16_t len);
boolean read_serial();
void reset();
void runModule(uint8_t device);
int16_t searchServoPin(int16_t pin);
void sendByte(uint8_t c);
void sendDouble(double value);
void sendFloat(float value);
void sendLong(long value);
void sendShort(int16_t value);
void sendString(String s);
void stepper_move_finish_callback(int slot,int extId);
void ultrCarProcess();
void writeBuffer(int16_t index,uint8_t c);
void writeEnd();
void writeHead();
void writeSerial(uint8_t c);

Then when you build the code, PlatformIO will automatically download the MakeBlockDrive library since you’ve indicated the project has a dependency on it, and it should compile fine. You will see a bunch of ‘problems’ listed, but the code will compile.

MakeBlockDrive library and examples

Yes.

First, in looking at eeprom I also noticed that there is an EEPROM. Also, some mornings I seem to get farther after the computer has been shutdown and restarted. Perhaps there is a reset button that I am unaware of. You mention the difference between warnings and errors. With Blink.cpp, I was getting supposed errors but took the seemingly bold effort to compile anyway. And Blink.cpp did in fact compile and run and is running now. So, they were in fact warnings and not compiler errors. I have moved on from Blink.cpp!

The firmware you refer to seems to be for a generic Makeblock board and is quite old. Makeblock has firmware for different purposes and versions all over the place. It is difficult to find the latest appropriate version.

Makeblock at GitHub lists five(5) versions of firmware. Presumably this is for five distinct boards. Although this concept puts into question robots and kits not listed. mBlock is their programing app. I have the Ultimate 2.0 kit. It is not their Starter kit. I do not know and have never heard of a “Pro”. Auriga? So, I use “Firmware_for_MegaPi” (Firmware_for_MegaPi.ino).

Firmware_For_mBlock
Firmware_for_Auriga
Firmware_for_MegaPi
Firmware_for_MegaPiPro
Firmware_for_Starter/starter_factory_firmware

/*************************************************************************

  • File Name : Firmware_for_MegaPi.ino
  • Author : myan
  • Updated : myan
  • Version : V0e.01.015
  • Date : 03/01/2018
  • Description : Firmware for Makeblock Electronic modules with Scratch.
  • License : CC-BY-SA 3.0
  • Copyright (C) 2013 - 2016 Maker Works Technology Co., Ltd. All right reserved.
  • http://www.makeblock.cc/
  • History:
  • Mark Yan 2016/03/12 0e.01.001 build the new.
  • Mark Yan 2016/05/04 0e.01.002 Added encoder and compass driver and fix some bugs.
  • Mark Yan 2016/05/07 0e.01.003 Delete watchdog and add On board stepper driver.
  • Mark Yan 2016/05/24 0e.01.004 Fix issue MBLOCK-1 and MBLOCK-12(JIRA issue).
  • Mark Yan 2016/06/07 0e.01.005 Fix encoder speed issue.
  • Mark Yan 2016/06/22 0e.01.006 Fix issue MAK-187 (bluetooth fatal error from MBLOCK-12)
  • Mark Yan 2016/06/25 0e.01.007 Fix issue MBLOCK-38(limit switch return value).
  • Mark Yan 2016/07/06 0e.01.008 Fix issue MBLOCK-61(ultrasonic distance limitations bug).
  • Mark Yan 2016/07/27 0e.01.009 Add position parameters for encoder motor,fix issue MBLOCK-77.
  • Mark Yan 2016/08/01 0e.01.010 Fix issue MBLOCK-109 MBLOCK-110(encoder motor exception handling negative).
  • Mark Yan 2016/08/10 0e.01.011 Fix issue MBLOCK-126(on board encoder motor speed symbol).
  • Mark Yan 2016/08/24 0e.01.012 Fix issue MBLOCK-171(Stepper online execution slow), MBLOCK-189(on board encoder motor reset issue).
  • Mark Yan 2017/03/01 0e.01.013 fix RGB lights issue.
  • Mark Yan 2017/06/21 0e.01.014 fix JIRA issue 668 710.
  • Mark Yan 2018/01/03 0e.01.015 add the absolute motor move for encode motor & add new stepper command.
  • Payton 2019/01/02 0e.01.016 in new stepper command, change SLOT1 to slot_num.

Vincent He 2019/01/04 3.2.6 1.Mbot /ranger adds the function of communication variables. 2.Solve the blocking problem of 9g steering gear. 3.Solve the problem that the intelligent steering gear cannot read back the parameters. 4.Add version number function. 5.High power code motor reinforcement version query function. 6.Solve the problem of SetColor (uint8_t index, long value) function error in mergharp.cpp. 7.The mBot board cannot extinguish the RGB. First upload the program with the RGB in any color, and then upload the program with the RGB in all colors. The RGB cannot extinguish (MeRGBLed bled. CPP file). 8.In the MegaPi firmware, SLOT1 is changed to slot_num instead of parameter transmission in the command processing stepper motor.

The Readme of 0e.01.016 calls it both 3.2.6 and 3.26! The most resent firmware for the Ultimate 2.0 seems to be 3.26(3.2.6)(0e.01.016)! Thus (0e.01.016), (3.2.6), (3.26), and (Firmware_for_MegaPi.ino) are all the same thing. My robot program is a copy/paste of the Makeblock firmware 3.2.6!

I am now back to my robot program. It lists at about 3100 lines. Realize that my Makeblock robot program builds on top of the Makeblock firmware software. I mean that my robot program IS the Makeblock firmware(3.2.6). The first 3000 lines of my robot program IS the Makeblock firmware. My original contribution of code amounts to about 100 lines.

The 52 functions that you list are the ones in Firmware_for_MegaPi.ino(3.2.6)! I know them well. I work with them every day. Makeblock uses this software to communicate with an Ipad or phone (Ios or Android) by Bluetooth(Serial2). My project is to replace the Ipad or phone with a wireless Nintendo Wii nunchuck.


  • Looking for NintendoExtensionCtrl.h dependency? Check our library registry!
  • CLI > platformio lib search “header:NintendoExtensionCtrl.h”
  • Web > PlatformIO Registry

My platformio.ini is now . . .

[env:megaatmega2560]
platform = atmelavr
lib_extra_dirs = ~/Documents/Arduino/libraries
lib_extra_dirs = ~/Program Files (x86)\Arduino
board = megaatmega2560
framework = arduino
lib_deps =
     Nintendo Extension Ctrl

Can you please give me a code snippet at line 251?

Thank you. Much appreciated.

I have a confusion. If I build. Find an error. Correct the error. Then build again. I would expect the error to be gone. It is not. I have to be at the bottom of the terminal. (Not the top!)

I have edited my robot program to remove all the “PROBLEMS”. It still does not compile. I get the error message

collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\megaatmega2560\firmware.elf] Error 1

I have no idea what this is.

Can you help?

Thank You

Gracias

Merci

Grazie

Danke sehr

I wouldn’t be able to comment on the cause of that latest error without seeing more of the error message, or the code so I could try to reproduce it.

For a snippet of line #251, this is what is on line 251.

typedef struct
{
  double P, I, D;
  double Setpoint, Output, Integral,differential, last_error;
} PID;

PID  PID_angle, PID_speed, PID_turn;

The very next section is the first of the functions

/**
 * \par Function
 *    encoder_move_finish_callback
 * \par Description
 *    This function called when encoder motor move finish.
 * \param[in]
 *    None
 * \par Output
 *    None
 * \return
 *    None
 * \par Others
 *    None
 */
void encoder_move_finish_callback(int slot,int extId)

Just make sure the aforementioned list of function prototypes is placed before that first function declaration. If you wanted, there is nothing to stop you putting it in right under all the #includes in the first few lines of the file… it simply needs to be located before any of the functions are actually declared.

The Arduino IDE does not require the functions to be pre-stated. It seams that C++ does. You have chosen after variable definition and before the first function. (line 251). I have literally chosen the line before the first function. (line 267). It amounts to about the same thing. But I am using an edited version of "Firmware_for_MegaPi.ino" 3.2.6! I am not sure that you are. Thank you.

That post was long enough. It was time for a break.

I may have a new issue. I have encountered Visual Studio extension conflicts(messages). So, some have been uninstalled and other installed. There may be a magic combination that works best. In my current install (as shone) most of the PlatformIO icons at the bottom of the screen do not show.

image

To get them back, I do a . . .

View > Command Palette… > PlatformIO: Rebuild IntelliSence Index

or

View > Command Palette… > PlatformIO: Build

The response that I get is

Activating extensions

And all the icons come back.

I have removed all of the "PROBLEMS" but get the one error message. I a including all of the TERMINAL text here.

Body is limited to 32000 characters; you entered 34809.

i will include what i can

> 
> &lt;artificial&gt;:(.text.startup+0x26a): undefined reference to `MeEncoderOnBoard::setPosPid(float, float, float)'
> 
> &lt;artificial&gt;:(.text.startup+0x284): undefined reference to `MeEncoderOnBoard::setSpeedPid(float, float, float)'
> 
> &lt;artificial&gt;:(.text.startup+0x298): undefined reference to `MeEncoderOnBoard::setSpeedPid(float, float, float)'
> 
> &lt;artificial&gt;:(.text.startup+0x2ac): undefined reference to `MeEncoderOnBoard::setSpeedPid(float, float, float)'
> 
> &lt;artificial&gt;:(.text.startup+0x2c0): undefined reference to `MeEncoderOnBoard::setSpeedPid(float, float, float)'
> 
> &lt;artificial&gt;:(.text.startup+0x2cc): undefined reference to `MeEncoderOnBoard::setMotionMode(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x2d8): undefined reference to `MeEncoderOnBoard::setMotionMode(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x2e4): undefined reference to `MeEncoderOnBoard::setMotionMode(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x2f0): undefined reference to `MeEncoderOnBoard::setMotionMode(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x908): undefined reference to `Me4Button::pressed()'
> 
> &lt;artificial&gt;:(.text.startup+0x980): undefined reference to `MeInfraredReceiver::loop()'
> 
> &lt;artificial&gt;:(.text.startup+0x98c): undefined reference to `MeInfraredReceiver::getCode()'
> 
> &lt;artificial&gt;:(.text.startup+0xa5c): undefined reference to `MeInfraredReceiver::buttonState()'
> 
> &lt;artificial&gt;:(.text.startup+0xa6c): undefined reference to `MeInfraredReceiver::loop()'
> 
> &lt;artificial&gt;:(.text.startup+0xa90): undefined reference to `MeStepperOnBoard::getPort()'
> 
> &lt;artificial&gt;:(.text.startup+0xaa2): undefined reference to `MeStepperOnBoard::getPort()'
> 
> &lt;artificial&gt;:(.text.startup+0xab4): undefined reference to `MeStepperOnBoard::getPort()'
> 
> &lt;artificial&gt;:(.text.startup+0xac6): undefined reference to `MeStepperOnBoard::getPort()'
> 
> &lt;artificial&gt;:(.text.startup+0xad2): undefined reference to `MeStepperOnBoard::update()'
> 
> &lt;artificial&gt;:(.text.startup+0xada): undefined reference to `MeEncoderOnBoard::loop()'
> 
> &lt;artificial&gt;:(.text.startup+0xae2): undefined reference to `MeEncoderOnBoard::loop()'
> 
> &lt;artificial&gt;:(.text.startup+0xaea): undefined reference to `MeEncoderOnBoard::loop()'
> 
> &lt;artificial&gt;:(.text.startup+0xaf2): undefined reference to `MeEncoderOnBoard::loop()'
> 
> &lt;artificial&gt;:(.text.startup+0x12da): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text.startup+0x12e6): undefined reference to `MeCompass::getAngle()'
> 
> &lt;artificial&gt;:(.text.startup+0x12ee): undefined reference to `MeGyro::getGyroY()'
> 
> &lt;artificial&gt;:(.text.startup+0x134c): undefined reference to `MeGyro::fast_update()'
> 
> &lt;artificial&gt;:(.text.startup+0x1370): undefined reference to `MeUltrasonicSensor::MeUltrasonicSensor(unsigned char)'
> 
> &lt;artificial&gt;:(.text.startup+0x139a): undefined reference to `MeUltrasonicSensor::distanceCm(unsigned int)'
> 
> &lt;artificial&gt;:(.text.startup+0x1424): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x1434): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x1464): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x1484): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x14bc): undefined reference to `MeGyro::fast_update()'
> 
> &lt;artificial&gt;:(.text.startup+0x14e4): undefined reference to `MeGyro::getAngleX()'
> 
> &lt;artificial&gt;:(.text.startup+0x1512): undefined reference to `MeGyro::getAngleX()'
> 
> &lt;artificial&gt;:(.text.startup+0x154e): undefined reference to `MeGyro::getAngleX()'
> 
> &lt;artificial&gt;:(.text.startup+0x157c): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x1588): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x15e6): undefined reference to `MeEncoderOnBoard::setPulsePos(long)'
> 
> &lt;artificial&gt;:(.text.startup+0x15f4): undefined reference to `MeEncoderOnBoard::setPulsePos(long)'
> 
> &lt;artificial&gt;:(.text.startup+0x1660): undefined reference to `MeGyro::getAngleX()'
> 
> &lt;artificial&gt;:(.text.startup+0x1ab2): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x1ac2): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x1b16): undefined reference to `MeEncoderOnBoard::getCurrentSpeed()'
> 
> &lt;artificial&gt;:(.text.startup+0x1b22): undefined reference to `MeEncoderOnBoard::getCurrentSpeed()'
> 
> &lt;artificial&gt;:(.text.startup+0x1fb6): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x1fca): undefined reference to `MeLineFollower::readSensors()'
> 
> &lt;artificial&gt;:(.text.startup+0x2054): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x2064): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x2086): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x209c): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text.startup+0x214c): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans0.ltrans.o:&lt;artificial&gt;:(.text.startup+0x2158): more undefined references to `MeEncoderOnBoard::setMotorPwm(int)' follow
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans0.ltrans.o: In function `main':
> 
> &lt;artificial&gt;:(.text.startup+0x2186): undefined reference to `MeEncoderOnBoard::setPulsePos(long)'
> 
> &lt;artificial&gt;:(.text.startup+0x2194): undefined reference to `MeEncoderOnBoard::setPulsePos(long)'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans1.ltrans.o: In function `isr_process_encoder4()':
> 
> &lt;artificial&gt;:(.text+0x30): undefined reference to `MeEncoderOnBoard::getPortB()'
> 
> &lt;artificial&gt;:(.text+0x40): undefined reference to `MeEncoderOnBoard::pulsePosMinus()'
> 
> &lt;artificial&gt;:(.text+0x48): undefined reference to `MeEncoderOnBoard::pulsePosPlus()'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans1.ltrans.o: In function `isr_process_encoder3()':
> 
> &lt;artificial&gt;:(.text+0x50): undefined reference to `MeEncoderOnBoard::getPortB()'
> 
> &lt;artificial&gt;:(.text+0x60): undefined reference to `MeEncoderOnBoard::pulsePosMinus()'
> 
> &lt;artificial&gt;:(.text+0x68): undefined reference to `MeEncoderOnBoard::pulsePosPlus()'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans1.ltrans.o: In function `isr_process_encoder2()':
> 
> &lt;artificial&gt;:(.text+0x70): undefined reference to `MeEncoderOnBoard::getPortB()'
> 
> &lt;artificial&gt;:(.text+0x80): undefined reference to `MeEncoderOnBoard::pulsePosMinus()'
> 
> &lt;artificial&gt;:(.text+0x88): undefined reference to `MeEncoderOnBoard::pulsePosPlus()'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans1.ltrans.o: In function `isr_process_encoder1()':
> 
> &lt;artificial&gt;:(.text+0x90): undefined reference to `MeEncoderOnBoard::getPortB()'
> 
> &lt;artificial&gt;:(.text+0xa0): undefined reference to `MeEncoderOnBoard::pulsePosMinus()'
> 
> &lt;artificial&gt;:(.text+0xa8): undefined reference to `MeEncoderOnBoard::pulsePosPlus()'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans1.ltrans.o: In function `Stop()':
> 
> &lt;artificial&gt;:(.text+0x262): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text+0x26e): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans1.ltrans.o: In function `TurnRight()':
> 
> &lt;artificial&gt;:(.text+0x28a): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text+0x2a0): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans1.ltrans.o: In function `TurnLeft()':
> 
> &lt;artificial&gt;:(.text+0x2b0): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans1.ltrans.o:&lt;artificial&gt;:(.text+0x2d2): more undefined references to `MeEncoderOnBoard::setMotorPwm(int)' follow
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans1.ltrans.o: In function `parseData()':
> 
> &lt;artificial&gt;:(.text+0x3c2): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x3e2): undefined reference to `MeUltrasonicSensor::MeUltrasonicSensor(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x3fa): undefined reference to `MeUltrasonicSensor::distanceCm(unsigned int)'
> 
> &lt;artificial&gt;:(.text+0x422): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x42e): undefined reference to `MePort::getSlot()'
> 
> &lt;artificial&gt;:(.text+0x43a): undefined reference to `MeTemperature::temperature()'
> 
> &lt;artificial&gt;:(.text+0x444): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x452): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x45a): undefined reference to `MePort::pin2()'
> 
> &lt;artificial&gt;:(.text+0x468): undefined reference to `MePort::aRead2()'
> 
> &lt;artificial&gt;:(.text+0x47c): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x48a): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x494): undefined reference to `MeJoystick::read(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x4a8): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x4be): undefined reference to `vtable for MeSerial'
> 
> &lt;artificial&gt;:(.text+0x4c0): undefined reference to `vtable for MeSerial'
> 
> &lt;artificial&gt;:(.text+0x518): undefined reference to `MeInfraredReceiver::MeInfraredReceiver(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x526): undefined reference to `MeInfraredReceiver::begin()'
> 
> &lt;artificial&gt;:(.text+0x532): undefined reference to `MeInfraredReceiver::getCode()'
> 
> &lt;artificial&gt;:(.text+0x546): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x554): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x55c): undefined reference to `MePort::pin2()'
> 
> &lt;artificial&gt;:(.text+0x56c): undefined reference to `MePort::dRead2(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x576): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x584): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x58c): undefined reference to `MePort::pin1()'
> 
> &lt;artificial&gt;:(.text+0x59a): undefined reference to `MePort::pin2()'
> 
> &lt;artificial&gt;:(.text+0x5aa): undefined reference to `MePort::dRead1(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x5b6): undefined reference to `MePort::dRead2(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x5d6): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x5e2): undefined reference to `MePort::getSlot()'
> 
> &lt;artificial&gt;:(.text+0x5f2): undefined reference to `MePort::pin1()'
> 
> &lt;artificial&gt;:(.text+0x602): undefined reference to `MePort::dRead1(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x60a): undefined reference to `MePort::pin2()'
> 
> &lt;artificial&gt;:(.text+0x61a): undefined reference to `MePort::dRead2(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x634): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x642): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x64a): undefined reference to `MePort::pin2()'
> 
> &lt;artificial&gt;:(.text+0x654): undefined reference to `MePort::pin1()'
> 
> &lt;artificial&gt;:(.text+0x660): undefined reference to `MeCompass::setpin(unsigned char, unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x668): undefined reference to `MeCompass::getAngle()'
> 
> &lt;artificial&gt;:(.text+0x67c): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x68a): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x692): undefined reference to `MeHumiture::update()'
> 
> &lt;artificial&gt;:(.text+0x69c): undefined reference to `MeHumiture::getValue(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x6b6): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x6c4): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x6cc): undefined reference to `MePort::pin1()'
> 
> &lt;artificial&gt;:(.text+0x6d6): undefined reference to `MePort::pin2()'
> 
> &lt;artificial&gt;:(.text+0x6e2): undefined reference to `MeFlameSensor::setpin(unsigned char, unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x6ea): undefined reference to `MeFlameSensor::readAnalog()'
> 
> &lt;artificial&gt;:(.text+0x6f4): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x702): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x70a): undefined reference to `MePort::pin1()'
> 
> &lt;artificial&gt;:(.text+0x714): undefined reference to `MePort::pin2()'
> 
> &lt;artificial&gt;:(.text+0x720): undefined reference to `MeGasSensor::setpin(unsigned char, unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x728): undefined reference to `MeGasSensor::readAnalog()'
> 
> &lt;artificial&gt;:(.text+0x744): undefined reference to `MeGyro::getDevAddr()'
> 
> &lt;artificial&gt;:(.text+0x91a): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x928): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x930): undefined reference to `MeTouchSensor::touched()'
> 
> &lt;artificial&gt;:(.text+0x93a): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x948): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x9d0): undefined reference to `MeEncoderOnBoard::getCurPos()'
> 
> &lt;artificial&gt;:(.text+0x9e2): undefined reference to `MeEncoderOnBoard::getCurrentSpeed()'
> 
> &lt;artificial&gt;:(.text+0xa14): undefined reference to `MeEncoderOnBoard::setPulsePos(long)'
> 
> &lt;artificial&gt;:(.text+0xa22): undefined reference to `MeEncoderOnBoard::setPulsePos(long)'
> 
> &lt;artificial&gt;:(.text+0xa30): undefined reference to `MeEncoderOnBoard::setPulsePos(long)'
> 
> &lt;artificial&gt;:(.text+0xa3e): undefined reference to `MeEncoderOnBoard::setPulsePos(long)'
> 
> &lt;artificial&gt;:(.text+0xa5c): undefined reference to `MeEncoderOnBoard::moveTo(long, float, int, void (*)(int, int))'
> 
> &lt;artificial&gt;:(.text+0xa72): undefined reference to `MeEncoderOnBoard::moveTo(long, float, int, void (*)(int, int))'
> 
> &lt;artificial&gt;:(.text+0xa88): undefined reference to `MeEncoderOnBoard::moveTo(long, float, int, void (*)(int, int))'
> 
> &lt;artificial&gt;:(.text+0xa9e): undefined reference to `MeEncoderOnBoard::moveTo(long, float, int, void (*)(int, int))'
> 
> &lt;artificial&gt;:(.text+0xaaa): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text+0xab6): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text+0xac2): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text+0xace): undefined reference to `MeEncoderOnBoard::setMotorPwm(int)'
> 
> &lt;artificial&gt;:(.text+0xada): undefined reference to `MeEncoderOnBoard::setMotionMode(int)'
> 
> &lt;artificial&gt;:(.text+0xae6): undefined reference to `MeEncoderOnBoard::setMotionMode(int)'
> 
> &lt;artificial&gt;:(.text+0xaf2): undefined reference to `MeEncoderOnBoard::setMotionMode(int)'
> 
> &lt;artificial&gt;:(.text+0xafe): undefined reference to `MeEncoderOnBoard::setMotionMode(int)'
> 
> &lt;artificial&gt;:(.text+0xb08): undefined reference to `MeMegaPiDCMotor::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0xb14): undefined reference to `MeMegaPiDCMotor::run(int)'
> 
> &lt;artificial&gt;:(.text+0xb1e): undefined reference to `MeMegaPiDCMotor::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0xb2a): undefined reference to `MeMegaPiDCMotor::run(int)'
> 
> &lt;artificial&gt;:(.text+0xb34): undefined reference to `MeMegaPiDCMotor::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0xb40): undefined reference to `MeMegaPiDCMotor::run(int)'
> 
> &lt;artificial&gt;:(.text+0xb4a): undefined reference to `MeMegaPiDCMotor::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0xb56): undefined reference to `MeMegaPiDCMotor::run(int)'
> 
> &lt;artificial&gt;:(.text+0xb60): undefined reference to `MeMegaPiDCMotor::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0xb6c): undefined reference to `MeMegaPiDCMotor::run(int)'
> 
> &lt;artificial&gt;:(.text+0xb76): undefined reference to `MeMegaPiDCMotor::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0xb82): undefined reference to `MeMegaPiDCMotor::run(int)'
> 
> &lt;artificial&gt;:(.text+0xb8c): undefined reference to `MeMegaPiDCMotor::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0xb98): undefined reference to `MeMegaPiDCMotor::run(int)'
> 
> &lt;artificial&gt;:(.text+0xba2): undefined reference to `MeMegaPiDCMotor::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0xbae): undefined reference to `MeMegaPiDCMotor::run(int)'
> 
> &lt;artificial&gt;:(.text+0xbbc): undefined reference to `MeStepperOnBoard::setCurrentPosition(long)'
> 
> &lt;artificial&gt;:(.text+0xbca): undefined reference to `MeStepperOnBoard::setCurrentPosition(long)'
> 
> &lt;artificial&gt;:(.text+0xbd8): undefined reference to `MeStepperOnBoard::setCurrentPosition(long)'
> 
> &lt;artificial&gt;:(.text+0xbe6): undefined reference to `MeStepperOnBoard::setCurrentPosition(long)'
> 
> &lt;artificial&gt;:(.text+0xbf4): undefined reference to `MeStepperOnBoard::moveTo(long)'
> 
> &lt;artificial&gt;:(.text+0xc02): undefined reference to `MeStepperOnBoard::moveTo(long)'
> 
> &lt;artificial&gt;:(.text+0xc10): undefined reference to `MeStepperOnBoard::moveTo(long)'
> 
> &lt;artificial&gt;:(.text+0xc1e): undefined reference to `MeStepperOnBoard::moveTo(long)'
> 
> &lt;artificial&gt;:(.text+0xc26): undefined reference to `MeStepperOnBoard::disableOutputs()'
> 
> &lt;artificial&gt;:(.text+0xc2e): undefined reference to `MeStepperOnBoard::disableOutputs()'
> 
> &lt;artificial&gt;:(.text+0xc36): undefined reference to `MeStepperOnBoard::disableOutputs()'
> 
> &lt;artificial&gt;:(.text+0xc3e): undefined reference to `MeStepperOnBoard::disableOutputs()'
> 
> &lt;artificial&gt;:(.text+0xc50): undefined reference to `MeTemperature::reset(unsigned char, unsigned char)'
> 
> &lt;artificial&gt;:(.text+0xc5e): undefined reference to `MePort::reset(unsigned char, unsigned char)'
> 
> &lt;artificial&gt;:(.text+0xc6a): undefined reference to `MeGyro::getAngle(unsigned char)'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans2.ltrans.o: In function `initStepper(unsigned char, int)':
> 
> &lt;artificial&gt;:(.text+0xc0): undefined reference to `MeStepperOnBoard::setMaxSpeed(float)'
> 
> &lt;artificial&gt;:(.text+0xce): undefined reference to `MeStepperOnBoard::setAcceleration(float)'
> 
> &lt;artificial&gt;:(.text+0xd6): undefined reference to `MeStepperOnBoard::setMicroStep(signed char)'
> 
> &lt;artificial&gt;:(.text+0xe0): undefined reference to `MeStepperOnBoard::setSpeed(float)'
> 
> &lt;artificial&gt;:(.text+0xf2): undefined reference to `MeStepperOnBoard::enableOutputs()'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans2.ltrans.o: In function `runModule(unsigned char)':
> 
> &lt;artificial&gt;:(.text+0x204): undefined reference to `MeMegaPiDCMotor::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x20e): undefined reference to `MeMegaPiDCMotor::run(int)'
> 
> &lt;artificial&gt;:(.text+0x240): undefined reference to `MeEncoderOnBoard::setTarPWM(int)'
> 
> &lt;artificial&gt;:(.text+0x268): undefined reference to `MeEncoderOnBoard::setTarPWM(int)'
> 
> &lt;artificial&gt;:(.text+0x2b8): undefined reference to `MeStepperOnBoard::MeStepperOnBoard(int)'
> 
> &lt;artificial&gt;:(.text+0x302): undefined reference to `MeStepperOnBoard::move(long, int, void (*)(int, int))'
> 
> &lt;artificial&gt;:(.text+0x320): undefined reference to `MeStepperOnBoard::MeStepperOnBoard(int)'
> 
> &lt;artificial&gt;:(.text+0x364): undefined reference to `MeStepperOnBoard::setSpeed(float)'
> 
> &lt;artificial&gt;:(.text+0x390): undefined reference to `MeStepperOnBoard::MeStepperOnBoard(int)'
> 
> &lt;artificial&gt;:(.text+0x3da): undefined reference to `MeStepperOnBoard::moveTo(long, int, void (*)(int, int))'
> 
> &lt;artificial&gt;:(.text+0x3ee): undefined reference to `MeStepperOnBoard::MeStepperOnBoard(int)'
> 
> &lt;artificial&gt;:(.text+0x41c): undefined reference to `MeStepperOnBoard::setCurrentPosition(long)'
> 
> &lt;artificial&gt;:(.text+0x440): undefined reference to `MeStepperOnBoard::MeStepperOnBoard(int)'
> 
> &lt;artificial&gt;:(.text+0x462): undefined reference to `MeStepperOnBoard::moveTo(long)'
> 
> &lt;artificial&gt;:(.text+0x49e): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x4aa): undefined reference to `MePort::getSlot()'
> 
> &lt;artificial&gt;:(.text+0x4c2): undefined reference to `MeRGBLed::setColorAt(unsigned char, unsigned char, unsigned char, unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x4d2): undefined reference to `MeRGBLed::setColor(unsigned char, unsigned char, unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x4da): undefined reference to `MeRGBLed::show()'
> 
> &lt;artificial&gt;:(.text+0x5d4): undefined reference to `Servo::attached()'
> 
> &lt;artificial&gt;:(.text+0x5e2): undefined reference to `Servo::attach(int)'
> 
> &lt;artificial&gt;:(.text+0x5ee): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x5fc): undefined reference to `Me7SegmentDisplay::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x610): undefined reference to `Me7SegmentDisplay::display(float)'
> 
> &lt;artificial&gt;:(.text+0x61a): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x628): undefined reference to `MeLEDMatrix::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x69a): undefined reference to `MeLEDMatrix::drawStr(int, signed char, char const*)'
> 
> &lt;artificial&gt;:(.text+0x6e8): undefined reference to `MeLEDMatrix::drawBitmap(signed char, signed char, unsigned char, unsigned char*)'
> 
> &lt;artificial&gt;:(.text+0x71e): undefined reference to `MeLEDMatrix::showClock(unsigned char, unsigned char, bool)'
> 
> &lt;artificial&gt;:(.text+0x73c): undefined reference to `MeLEDMatrix::showNum(float, unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x746): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x754): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x76e): undefined reference to `MePort::getPort()'
> 
> &lt;artificial&gt;:(.text+0x77c): undefined reference to `MePort::reset(unsigned char)'
> 
> &lt;artificial&gt;:(.text+0x794): undefined reference to `MePort::dWrite1(bool)'
> 
> &lt;artificial&gt;:(.text+0x7a6): undefined reference to `MePort::dWrite2(bool)'
> 
> &lt;artificial&gt;:(.text+0x9c0): undefined reference to `Servo::attached()'
> 
> &lt;artificial&gt;:(.text+0x9ce): undefined reference to `Servo::attach(int)'
> 
> &lt;artificial&gt;:(.text+0x9da): undefined reference to `Servo::write(int)'
> 
> &lt;artificial&gt;:(.text+0xc62): undefined reference to `MeEncoderOnBoard::moveTo(long, float, int, void (*)(int, int))'
> 
> &lt;artificial&gt;:(.text+0xcdc): undefined reference to `MeEncoderOnBoard::runSpeed(float)'
> 
> &lt;artificial&gt;:(.text+0xd5a): undefined reference to `MeEncoderOnBoard::setPulsePos(long)'
> 
> &lt;artificial&gt;:(.text+0xda2): undefined reference to `MeEncoderOnBoard::move(long, float, int, void (*)(int, int))'
> 
> &lt;artificial&gt;:(.text+0xe3a): undefined reference to `MeEncoderOnBoard::move(long, float, int, void (*)(int, int))'
> 
> &lt;artificial&gt;:(.text+0xe4a): undefined reference to `MeEncoderOnBoard::move(long, float, int, void (*)(int, int))'
> 
> &lt;artificial&gt;:(.text+0xee4): undefined reference to `MeRGBLed::reset(unsigned char, unsigned char)'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans4.ltrans.o: In function `global constructors keyed to 65535_0_Firmware_for_MegaPi_0e.01.016_MAM_7.cpp.o.3788':
> 
> &lt;artificial&gt;:(.text.startup+0x1a2): undefined reference to `Servo::Servo()'
> 
> &lt;artificial&gt;:(.text.startup+0x1b4): undefined reference to `MeMegaPiDCMotor::MeMegaPiDCMotor()'
> 
> &lt;artificial&gt;:(.text.startup+0x1bc): undefined reference to `MeTemperature::MeTemperature()'
> 
> &lt;artificial&gt;:(.text.startup+0x1c4): undefined reference to `MeRGBLed::MeRGBLed()'
> 
> &lt;artificial&gt;:(.text.startup+0x1cc): undefined reference to `Me7SegmentDisplay::Me7SegmentDisplay()'
> 
> &lt;artificial&gt;:(.text.startup+0x1d4): undefined reference to `MePort::MePort()'
> 
> &lt;artificial&gt;:(.text.startup+0x1dc): undefined reference to `MeLEDMatrix::MeLEDMatrix()'
> 
> &lt;artificial&gt;:(.text.startup+0x1e8): undefined reference to `MeGyro::MeGyro(unsigned char, unsigned char)'
> 
> &lt;artificial&gt;:(.text.startup+0x1f0): undefined reference to `MeCompass::MeCompass()'
> 
> &lt;artificial&gt;:(.text.startup+0x1f8): undefined reference to `MeJoystick::MeJoystick()'
> 
> &lt;artificial&gt;:(.text.startup+0x200): undefined reference to `MeStepperOnBoard::MeStepperOnBoard()'
> 
> &lt;artificial&gt;:(.text.startup+0x208): undefined reference to `MeStepperOnBoard::MeStepperOnBoard()'
> 
> &lt;artificial&gt;:(.text.startup+0x210): undefined reference to `MeStepperOnBoard::MeStepperOnBoard()'
> 
> &lt;artificial&gt;:(.text.startup+0x218): undefined reference to `MeStepperOnBoard::MeStepperOnBoard()'
> 
> &lt;artificial&gt;:(.text.startup+0x220): undefined reference to `MeBuzzer::MeBuzzer()'
> 
> &lt;artificial&gt;:(.text.startup+0x228): undefined reference to `MeHumiture::MeHumiture()'
> 
> &lt;artificial&gt;:(.text.startup+0x230): undefined reference to `MeFlameSensor::MeFlameSensor()'
> 
> &lt;artificial&gt;:(.text.startup+0x238): undefined reference to `MeGasSensor::MeGasSensor()'
> 
> &lt;artificial&gt;:(.text.startup+0x240): undefined reference to `MeTouchSensor::MeTouchSensor()'
> 
> &lt;artificial&gt;:(.text.startup+0x248): undefined reference to `Me4Button::Me4Button()'
> 
> &lt;artificial&gt;:(.text.startup+0x252): undefined reference to `MeEncoderOnBoard::MeEncoderOnBoard(unsigned char)'
> 
> &lt;artificial&gt;:(.text.startup+0x25c): undefined reference to `MeEncoderOnBoard::MeEncoderOnBoard(unsigned char)'
> 
> &lt;artificial&gt;:(.text.startup+0x266): undefined reference to `MeEncoderOnBoard::MeEncoderOnBoard(unsigned char)'
> 
> &lt;artificial&gt;:(.text.startup+0x270): undefined reference to `MeEncoderOnBoard::MeEncoderOnBoard(unsigned char)'
> 
> &lt;artificial&gt;:(.text.startup+0x27a): undefined reference to `MeLineFollower::MeLineFollower(unsigned char)'
> 
> &lt;artificial&gt;:(.text.startup+0x282): undefined reference to `MeGyro::MeGyro()'
> 
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccftOw8q.ltrans3.ltrans.o: In function `_GLOBAL__sub_D_mePort':
> 
> &lt;artificial&gt;:(.text.exit+0xc): undefined reference to `MeRGBLed::~MeRGBLed()'
> 
> collect2.exe: error: ld returned 1 exit status
> 
> *** [.pioenvs\megaatmega2560\firmware.elf] Error 1
> 
> ======================================================================================= [ERROR] Took 4.45 seconds =======================================================================================
> 
> The terminal process terminated with exit code: 1
> 
> Terminal will be reused by tasks, press any key to close it.

I think the “C++ Intellisense” extension by ‘austin’ conflicts with PlatformIO?

Can you provide a link to your exact edited version?

Exactly, that’s why it compiles with INO extension but not with CPP extension. Arduino IDE generates the function prototype declarations for you for conform, but normally this code would violate C++ standards. There is a section in the FAQ that explains this: Redirecting...

This implies that the decleration of the function was found, but its implementation was not provided or not compiled in. In which CPP files to they implement this function? Was this file also placed in the src/ folder?

1 Like

The error message is . . .

"Conflicted extensions with IntelliSense service were detected (Arduino). Code completion, linting and navigation will not work properly. Please disable or uninstall them (Menu > View > Extensions)."

The extensions have the buttons Enable, Disable, Uninstall, Reload Required. After pressing one, sometimes I get the message . . .

Please reload Visual Studio Code to complete the disabling of this extension.

And it never shows up on a print screen.

Anyway, the PlatformIO buttons are back.

Exactly, that’s why it complies with INO extension but not with CPP extension.

I under appreciated the Arduino IDE’s efforts. I have read the FAQ. Thanks for the extra info.

This is a conversion problem from INO to CPP.

Respectfully, again, my robot program is 99% the "firmware_for_Mega.ino". I do not need to link to the firmware because my program is the firmware. At least it worked that way with Arduino. All of the Makeblock code is in the file. The Nintendo code must be imported. I have put my robot program into DropBox. But I may have to take it back. Windows 7 did a MOVE and not a COPY. Following is the link I was given to my robot program. Realize that this code was not polished for distribution. It is a demonstration of a beginners learning process.

As I look at the file names in the error messages, I realize that these are the individual files in the Makeblock library. Perhaps I am not properly connected to that library. My platformio.ini is as follows . . .

> [env:megaatmega2560]
> platform = atmelavr
> ;lib_extra_dirs = ~/Documents/Arduino/libraries
> lib_extra_dirs =C:\Users\CL Plane Guy 3\Documents\Arduino\libraries\Makeblock-Libraries-master\src
> ;lib_extra_dirs = ~/Program Files (x86)\Arduino
> board = megaatmega2560
> framework = arduino
> lib_deps =
> Nintendo Extension
> Ctrllib_deps = MakeBlockDrive

I have the library at
C:\Users\CL Plane Guy 3\Documents\Arduino\libraries\Makeblock-Libraries-master\src

> Collected 8 compatible libraries
> Scanning dependencies...
> Dependency Graph
> |-- <MakeBlockDrive> **3.24**
> |   |-- <utility>
> |-- <Nintendo Extension Ctrl> 0.7.2
> |   |-- <utility>
> |-- <utility>
> Linking .pioenvs\megaatmega2560\firmware.elf
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccKeBNdL.ltrans0.ltrans.o: In function `main':
> <artificial>:(.text.startup+0x23c): undefined reference to `Wire'
> <artificial>:(.text.startup+0x23e): undefined reference to `Wire'
> <artificial>:(.text.startup+0x240): undefined reference to `TwoWire::begin()'
> <artificial>:(.text.startup+0xa14): undefined reference to `TwoWire::begin()'
> <artificial>:(.text.startup+0xab8): undefined reference to `TwoWire::requestFrom(unsigned char, unsigned char)'
> C:\Users\CLPLAN~1\AppData\Local\Temp\ccKeBNdL.ltrans5.ltrans.o: In function `MeCompass::writeData(unsigned char, unsigned char const*, unsigned char) [clone .constprop.37]':
> <artificial>:(.text+0x8da): undefined reference to `Wire

Makeblock is now up to 3.26!

Yes, that is correct, however they have not updated the version flags in the library since 3.24, hence the discrepancy, as noted here, along with instruction on how to use the later 3.26 with platformio until the correction is made.

It’s also interesting to note that there is another pull request from December where someone has gone to the trouble of fixing some (but not all) of the warning’s that come up when compiling… but it hasn’t been accepted yet, so I wouldn’t hold my breath on a quick response…