Unable to use variables to move mBot forward


#1

I have a code designed to crawl through a maze. The issue I have is the move left and right wheels do not accept variables as input without giving me a compiler error.

I receive the following error:

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\CODENINJAS\mblock-avr\temp\build\code.cpp” -o “C:\Users\CODENINJAS\mblock-avr\temp\build\code.o” C:\Users\CODENINJAS\mblock-avr\temp\build\code.cpp: In function ‘void loop()’:
C:\Users\CODENINJAS\mblock-avr\temp\build\code.cpp:106:24: error: expected primary-expression before ‘/’ token
motor_9.run(-1 * ( / 100.0 * 255));
^
C:\Users\CODENINJAS\mblock-avr\temp\build\code.cpp:107:19: error: expected primary-expression before ‘/’ token
motor_10.run( / 100.0 * 255);
^
Failed to compile file code.cpp
arduino build failed.e code.cpp
arduino build failed.

The code I have is the following:


#2

It seems that the variable cannot be detected in this block:
image
I am checking with the software team.


#3

I assume that the compiler is seeing the variables as “blank”. Which is why the

error: expected primary-expression before ‘/’ token
motor_9.run(-1 * ( / 100.0 * 255));

is appearing. I believe it should show:

motor_9.run(-1 * ( VARIABLE/ 100.0 * 255));


#4

Yes, you are right. That seems the problem in mBot. We confirmed that and will fix it in the next version.


#5

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