Live works but upload fails


#1

Hello,
I have an mBot that I built yesterday and it drives using both Bluetooth and IR remote that came in the kit.
I started putting together a servo motor kit, and wanted to test it to verify the simple code that I created works.
In the live setting - when connected it works as expected.
I tried uploading it, but it failed - see message below -
start processing code…
processing code by middleware of arduino_formatter
avr-toolchain\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\ProgramData\mBlock5\IdeServicePlus\app\external\arduino\avr-library\variants\standard" -I"avr-library/cores/arduino" -I"arduino-libraries/makeblock/src" -I"arduino-libraries/makeblock/src/utility/avr" -I"avr-library/libraries/Wire/utility" -I"avr-library/libraries/Wire" -I"avr-library/libraries/SoftwareSerial" -I"arduino-libraries/arduino/WiFi/src/" -I"arduino-libraries/arduino/SD/src/" -I"arduino-libraries/arduino/Bridge/src/" -I"arduino-libraries/arduino/Temboo/src/" -I"arduino-libraries/arduino/Servo/src/" -I"arduino-libraries/arduino/Ethernet/src/" -I"arduino-libraries/arduino/TFT/src/" -I"arduino-libraries/arduino/SpacebrewYun/src/" -I"arduino-libraries/arduino/LiquidCrystal/src/" -I"arduino-libraries/arduino/GSM/src/" “C:\Users\Mike\mblock-avr\temp\build\src\demo.cpp” -o “C:\Users\Mike\mblock-avr\temp\build\src\demo.o”
avr-toolchain\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\ProgramData\mBlock5\IdeServicePlus\app\external\arduino\avr-library\variants\standard" -I"avr-library/cores/arduino" -I"arduino-libraries/makeblock/src" -I"arduino-libraries/makeblock/src/utility/avr" -I"avr-library/libraries/Wire/utility" -I"avr-library/libraries/Wire" -I"avr-library/libraries/SoftwareSerial" -I"arduino-libraries/arduino/WiFi/src/" -I"arduino-libraries/arduino/SD/src/" -I"arduino-libraries/arduino/Bridge/src/" -I"arduino-libraries/arduino/Temboo/src/" -I"arduino-libraries/arduino/Servo/src/" -I"arduino-libraries/arduino/Ethernet/src/" -I"arduino-libraries/arduino/TFT/src/" -I"arduino-libraries/arduino/SpacebrewYun/src/" -I"arduino-libraries/arduino/LiquidCrystal/src/" -I"arduino-libraries/arduino/GSM/src/" “C:\Users\Mike\mblock-avr\temp\build\src\MMA7660.cpp” -o “C:\Users\Mike\mblock-avr\temp\build\src\MMA7660.o”
avr-toolchain\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\ProgramData\mBlock5\IdeServicePlus\app\external\arduino\avr-library\variants\standard" -I"avr-library/cores/arduino" -I"arduino-libraries/makeblock/src" -I"arduino-libraries/makeblock/src/utility/avr" -I"avr-library/libraries/Wire/utility" -I"avr-library/libraries/Wire" -I"avr-library/libraries/SoftwareSerial" -I"arduino-libraries/arduino/WiFi/src/" -I"arduino-libraries/arduino/SD/src/" -I"arduino-libraries/arduino/Bridge/src/" -I"arduino-libraries/arduino/Temboo/src/" -I"arduino-libraries/arduino/Servo/src/" -I"arduino-libraries/arduino/Ethernet/src/" -I"arduino-libraries/arduino/TFT/src/" -I"arduino-libraries/arduino/SpacebrewYun/src/" -I"arduino-libraries/arduino/LiquidCrystal/src/" -I"arduino-libraries/arduino/GSM/src/" “C:\Users\Mike\mblock-avr\temp\build\src\rgb_lcd.cpp” -o “C:\Users\Mike\mblock-avr\temp\build\src\rgb_lcd.o”
avr-toolchain\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\ProgramData\mBlock5\IdeServicePlus\app\external\arduino\avr-library\variants\standard" -I"avr-library/cores/arduino" -I"arduino-libraries/makeblock/src" -I"arduino-libraries/makeblock/src/utility/avr" -I"avr-library/libraries/Wire/utility" -I"avr-library/libraries/Wire" -I"avr-library/libraries/SoftwareSerial" -I"arduino-libraries/arduino/WiFi/src/" -I"arduino-libraries/arduino/SD/src/" -I"arduino-libraries/arduino/Bridge/src/" -I"arduino-libraries/arduino/Temboo/src/" -I"arduino-libraries/arduino/Servo/src/" -I"arduino-libraries/arduino/Ethernet/src/" -I"arduino-libraries/arduino/TFT/src/" -I"arduino-libraries/arduino/SpacebrewYun/src/" -I"arduino-libraries/arduino/LiquidCrystal/src/" -I"arduino-libraries/arduino/GSM/src/" “C:\Users\Mike\mblock-avr\temp\build\code.cpp” -o “C:\Users\Mike\mblock-avr\temp\build\code.o”
Command failed: avr-toolchain\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\ProgramData\mBlock5\IdeServicePlus\app\external\arduino\avr-library\variants\standard" -I"avr-library/cores/arduino" -I"arduino-libraries/makeblock/src" -I"arduino-libraries/makeblock/src/utility/avr" -I"avr-library/libraries/Wire/utility" -I"avr-library/libraries/Wire" -I"avr-library/libraries/SoftwareSerial" -I"arduino-libraries/arduino/WiFi/src/" -I"arduino-libraries/arduino/SD/src/" -I"arduino-libraries/arduino/Bridge/src/" -I"arduino-libraries/arduino/Temboo/src/" -I"arduino-libraries/arduino/Servo/src/" -I"arduino-libraries/arduino/Ethernet/src/" -I"arduino-libraries/arduino/TFT/src/" -I"arduino-libraries/arduino/SpacebrewYun/src/" -I"arduino-libraries/arduino/LiquidCrystal/src/" -I"arduino-libraries/arduino/GSM/src/" “C:\Users\Mike\mblock-avr\temp\build\code.cpp” -o “C:\Users\Mike\mblock-avr\temp\build\code.o” C:\Users\Mike\mblock-avr\temp\build\code.cpp: In function ‘void _delay(float)’: C:\Users\Mike\mblock-avr\temp\build\code.cpp:10:25: error: ‘millis’ was not declared in this scope long endTime = millis() + seconds * 1000; ^
Failed to compile file code.cpp
arduino build failed.

the Arduino tab next to the Block tab shows this -
// generated by mBlock5 for mBot
// codes make you happy

void _delay(float seconds) {
long endTime = millis() + seconds * 1000;
while(millis() < endTime) _loop();
}

void setup() {
}

void _loop() {
}

void loop() {
_loop();
}

It is a very simple code to move the servo motor back and forth once by pressing a key on the key pad.
I tested the LEDs per the instructions with the mBot servo pack and they worked as expected also.

Any ideas where I went wrong??

1st time user
Thanks


#2

Upload is not possible using Bluetooth - did you try the USB cable that came with the mBot?


#3

Yes - I connected the mBot to the laptop via usb cable from the kit.
The code that I created works using the “live” format.
It fails to upload when I switch to the “upload” format.
I wonder if maybe I was suppose to upload Arduino iDE also?
Or, was that included in the makeblock software?
The block coding that I created doesn’t look like it is being converted to Arduino too allow it to upload.
Thoughts?


#4

May I have your codes (block version)?


#5

I have a mBot V1.1 Blue-Bluetooth version and a mBot Servo pack1.1


#6

Did you use the “when mBot starts” block instead of the green flag block as a start?


#7

Hi Andreas,
Well - no I did not. I didn’t realize that I had to do that, because the event area had that block greyed out when I was creating the original servo code while using the “live” mode.
I see that “when mBot starts up” it is available to drag over once the “upload” button has been switched to.

I will give that a try now, and let you know how it goes.

Thanks so much,


#8

I was not able to upload the file using V5, but was able to upload a different file I created in V3 using V3 Arduino upload. Unfortunately, the upload didn’t work after it completed - in fact nothing worked, so I had to restore to factory settings in order to get back to a working mBot.

Thanks for sharing the suggestion though.
I will just keep trying to figure this out.


#9

Hi meaubry1,
Files saved in mBlock 3 may not be working in mBlock 5.
I am confused it uploaded successfully but not take any respond?
Would you mind we having a remote control to your side? We can use Anydesk and Skype for video call. And I work from 9:00 am to 18:30 pm, Mon-Fri, China time.


#10

Hello
I finally figured out that the computer I was using didn’t have a Bluetooth driver after uploading Windows 10.
Better news - I was able to create a custom controller using makeblock app on my iPhone.
With the custom control, I was able to create a set of buttons and codes to operate the servo motor.
I will use the laptop to teach the students coding basics, but then use the iPhone to customize the mBots they are building with code that will operate the servo motor from the servo motor kit.

Thanks for your help, but I think I got this figured out now.

Mike


#11

Hi meaubry1,
Glad to hear that.
And thank you for your sharing and support on Makeblock. :slight_smile: