Weird, I see the same code gen error in 3.4.9 on the Mac. However, on 3.4.8 I get the following code generated from your program:
#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 currentTime = 0;
double lastTime = 0;
double getLastTime(){
return currentTime = millis()/1000.0 - lastTime;
}
void setup(){
pinMode(A7,INPUT);
while(!((0^(analogRead(A7)>10?0:1))))
{
_loop();
}
lastTime = millis()/1000.0;
}
void loop(){
if((getLastTime()) < (6000)){
move(1,255);
}else{
move(1,0);
}
_loop();
}
void _delay(float seconds){
long endTime = millis() + seconds * 1000;
while(millis() < endTime)_loop();
}
void _loop(){
}
I’m not seeing a redefinition for currentTime or lastTime so the bug was apparently fixed in 3.4.8 and then re-broken in 3.4.9. Also, note that tin the getLastTime() method that the time is being converted to seconds by dividing the return value of the millis() method by 1000. I suspect this is done as a convenience for younger audiences.