Hello,
I have created a new mbot project. I work on it and when I upload it on my mbot arduino card, it’s write an error message. It’s write :
compilation terminated.
Erreur de compilation. (Compilation error)
or
RDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\variants\standard -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\libraries\Wire -IC:\Program Files (x86)\mBlock\Arduino\hardware\arduino\avr\libraries\SoftwareSerial -IC:\Program Files (x86)\mBlock\Arduino\portable\sketchbook\libraries\makeblock\src C:\Users\JAUNEC~1\AppData\Local\Temp\build4036469759547372272.tmp\project_lumi_reMagic4_4.cpp -o C:\Users\JAUNEC~1\AppData\Local\Temp\build4036469759547372272.tmp\project_lumi_reMagic4_4.cpp.o
project_lumi_reMagic4_4.ino: In function ‘void setup()’:
project_lumi_reMagic4_4.ino:186:46: error: no matching function for call to ‘MeLEDMatrix::showNum(StringSumHelper&, int)’
project_lumi_reMagic4_4.ino:186:46: note: candidate is:
In file included from C:\Program Files (x86)\mBlock\Arduino\portable\sketchbook\libraries\makeblock\src/MeMCore.h:69:0,
from project_lumi_reMagic4_4.ino:5:
C:\Program Files (x86)\mBlock\Arduino\portable\sketchbook\libraries\makeblock\src/MeLEDMatrix.h:246:8: note: void MeLEDMatrix::showNum(float, uint8_t)
void showNum(float value,uint8_t = 3);
^
C:\Program Files (x86)\mBlock\Arduino\portable\sketchbook\libraries\makeblock\src/MeLEDMatrix.h:246:8: note: no known conversion for argument 1 from ‘StringSumHelper’ to ‘float’
no matching function for call to ‘MeLEDMatrix::showNum(StringSumHelper&, int)’
(Sorry for my bad English… I speak french (Quebec) and I try to not use google translate to practice it.)
Click the link to download the sb2 project. Some blocks are not attached because I am not using them and I want to keep them if I have to re-use them. I am using the mblock software v3.4.11 and I am on windows 10. My mbot is connected to my pc with the included USB cable.
My Arduino code :
#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>#include <MeMCore.h>
MeDCMotor motor_9(9);
MeDCMotor motor_10(10);void move(int direction, int speed)
{
int leftSpeed = 0;
int rightSpeed = 0;
if(direction == 1){
leftSpeed = speed;
rightSpeed = speed;
}else if(direction == 2){
leftSpeed = -speed;
rightSpeed = -speed;
}else if(direction == 3){
leftSpeed = -speed;
rightSpeed = speed;
}else if(direction == 4){
leftSpeed = speed;
rightSpeed = -speed;
}
motor_9.run((9)==M1?-(leftSpeed):(leftSpeed));
motor_10.run((10)==M1?-(rightSpeed):(rightSpeed));
}double angle_rad = PI/180.0;
double angle_deg = 180.0/PI;
double __var__108_117_109_105_110_111_115_105_116_233;
double mode;
double bruit;
double x;
double pv;
double pv2;
double joueur;
MeRGBLed rgbled_7(7, 7==7?2:4);
MeRGBLed rgbled_3(3, 3==7?2:4);
MeLEDMatrix ledMtx_1(1);
MeBuzzer buzzer;
unsigned char drawBuffer[16];
unsigned char *drawTemp;
double currentTime = 0;
double lastTime = 0;
MeIR ir;
double getLastTime(){
return currentTime = millis()/1000.0 - lastTime;
}
MeSoundSensor soundsensor_4(4);void setup(){
ledMtx_1.setColorIndex(1);
ledMtx_1.setBrightness(6);
ir.begin();
rgbled_7.setColor(0,0,255,0);
rgbled_7.show();
rgbled_3.setColor(0,0,255,0);
rgbled_3.show();
_delay(1);
__var__108_117_109_105_110_111_115_105_116_233 = 0;
mode = 1;
bruit = 0;
x = 0;
pv = 20;
pv2 = 20;
ledMtx_1.drawStr(0,0+7,“YO!”);
buzzer.tone(65, 250);
delay(20);
buzzer.tone(73, 250);
delay(20);
buzzer.tone(82, 250);
delay(20);
buzzer.tone(87, 250);
delay(20);
buzzer.tone(98, 250);
delay(20);
buzzer.tone(110, 250);
delay(20);
buzzer.tone(123, 250);
delay(20);
drawTemp = new unsigned char[16]{0,16,32,64,68,34,19,3,3,19,34,68,64,32,16,0};
memcpy(drawBuffer,drawTemp,16);
free(drawTemp);
ledMtx_1.drawBitmap(0,0,16,drawBuffer);
_delay(1);
lastTime = millis()/1000.0;
pinMode(A7,INPUT);
while(!((ir.keyPressed(69)) || ((0^(analogRead(A7)>10?0:1)))))
{
_loop();
ledMtx_1.drawStr(x,0+7,“DUEL MAGIC BIENTOT!”);
x += -1;
_delay(0.1);
if((getLastTime()) > (12)){
lastTime = millis()/1000.0;
x = 0;
}
}
while(!(ir.keyPressed(69)))
{
_loop();
joueur = random(1,(2)+1);
_delay(0.001);
if(((joueur)==(1))){
drawTemp = new unsigned char[16]{0,0,0,24,60,126,219,153,24,24,24,24,24,24,24,24};
memcpy(drawBuffer,drawTemp,16);
free(drawTemp);
ledMtx_1.drawBitmap(0,0,16,drawBuffer);
}
if(((joueur)==(2))){
drawTemp = new unsigned char[16]{24,24,24,24,24,24,24,24,153,219,126,60,24,0,0,0};
memcpy(drawBuffer,drawTemp,16);
free(drawTemp);
ledMtx_1.drawBitmap(0,0,16,drawBuffer);
}
}
if(((joueur)==(1))){
drawTemp = new unsigned char[16]{0,0,0,24,60,126,219,153,24,24,24,24,24,24,24,24};
memcpy(drawBuffer,drawTemp,16);
free(drawTemp);
ledMtx_1.drawBitmap(0,0,16,drawBuffer);
}
if(((joueur)==(2))){
drawTemp = new unsigned char[16]{24,24,24,24,24,24,24,24,153,219,126,60,24,0,0,0};
memcpy(drawBuffer,drawTemp,16);
free(drawTemp);
ledMtx_1.drawBitmap(0,0,16,drawBuffer);
}
_delay(5);
drawTemp = new unsigned char[16]{255,129,137,143,0,255,129,129,129,255,0,253,0,253,0,253};
memcpy(drawBuffer,drawTemp,16);
free(drawTemp);
ledMtx_1.drawBitmap(0,0,16,drawBuffer);
buzzer.tone(262, 250);
delay(20);
buzzer.tone(294, 250);
delay(20);
buzzer.tone(330, 500);
delay(20);
rgbled_7.setColor(0,255,128,0);
rgbled_7.show();
x = 0;
lastTime = millis()/1000.0;
while(!(ir.keyPressed(13)))
{
_loop();
if((((mode)==(0))) && (((0^(analogRead(A7)>10?0:1))) || (ir.keyPressed(21)))){
buzzer.tone(262, 125);
delay(20);
mode = 1;
}
if((((mode)==(1))) && (((0^(analogRead(A7)>10?0:1))) || (ir.keyPressed(21)))){
buzzer.tone(262, 125);
delay(20);
mode = 0;
}
if(((mode)==(0))){
if((((bruit)==(1))) && ((soundsensor_4.strength()) > (600))){
bruit = 0;
buzzer.tone(262, 500);
delay(20);
}
}
if(((mode)==(1))){
rgbled_3.setColor(0,255,128,0);
rgbled_3.show();
}
if((((bruit)==(0))) && ((soundsensor_4.strength()) > (500))){
bruit = 1;
buzzer.tone(262, 500);
delay(20);
}
if(((bruit)==(1))){
rgbled_3.setColor(0,255,255,255);
rgbled_3.show();
}
if(((bruit)==(0))){
rgbled_3.setColor(0,0,0,0);
rgbled_3.show();
}
ledMtx_1.showNum(pv,3);
if(ir.keyPressed(25)){
pv += -1;
_delay(0.2);
}
if(ir.keyPressed(64)){
pv += 1;
_delay(0.2);
}
if(ir.keyPressed(7)){
pv2 += -1;
_delay(0.2);
}
if(ir.keyPressed(9)){
pv2 += 1;
_delay(0.2);
}
}}
void loop(){
drawTemp = new unsigned char[16]{0,128,64,96,72,142,15,15,15,15,142,72,96,64,128,0};
memcpy(drawBuffer,drawTemp,16);
free(drawTemp);
ledMtx_1.drawBitmap(0,0,16,drawBuffer);
buzzer.tone(262, 500);
delay(20);
buzzer.tone(294, 500);
delay(20);
buzzer.tone(330, 1000);
delay(20);
rgbled_7.setColor(0,255,0,0);
rgbled_7.show();
rgbled_3.setColor(0,255,0,0);
rgbled_3.show();
drawTemp = new unsigned char[16]{255,152,148,243,0,195,255,255,195,0,255,144,144,240,0,253};
memcpy(drawBuffer,drawTemp,16);
free(drawTemp);
ledMtx_1.drawBitmap(0,0,16,drawBuffer);
buzzer.tone(262, 500);
delay(20);
buzzer.tone(294, 500);
delay(20);
buzzer.tone(330, 1000);
delay(20);_loop();
}
void _delay(float seconds){
long endTime = millis() + seconds * 1000;
while(millis() < endTime)_loop();
}void _loop(){
ir.loop();}
lumière Magic.sb2 (76.4 KB)