Технический форум по робототехнике.
Dmitry__ писал(а):slom, терминатор, музыка.... Мы все умрем?
int volts; // battery voltage*10 (accurate to 1 decimal place)
int lowbat=550; // default low battery voltage is 5.5V
void Shutdown()
{
//================ Shutdown motors and servos when battery is flat ==============
lmspeed=0; // set left motor speed to 0 (off)
rmspeed=0; // set right motor speed to 0 (off)
Motors(); // update H bridges
servopos[0]=0; // ensure servo 0 is detached
servopos[1]=0; // ensure servo 1 is detached
servopos[2]=0; // ensure servo 2 is detached
servopos[3]=0; // ensure servo 3 is detached
servopos[4]=0; // ensure servo 4 is detached
servopos[5]=0; // ensure servo 5 is detached
Servos(); // update servo pins
}
//----------------------------------------------------- Shutdown mode ----------------------------------------------------------------
if (mode==3) // if battery voltage too low
{
Shutdown(); // Shutdown motors and servos
return;
}
}
i=Wire.read()*256+Wire.read(); // read integer from I²C buffer
if(i>549 && i<3001)
{
lowbat=i; // set low battery value (values higher than battery voltage will force a shutdown)
}
else
{
errorflag = errorflag | 32; // incorrect lowbat given
}
b=Wire.read(); // read byte from buffer
if(b<128)
{
I2Caddress=b; // change I²C address
EEPROM.write(1,b); // update EEPROM with new I²C address
}
else
{
errorflag = errorflag | 64; // incorrect I²C address given
}
slom писал(а): акумы в него идально входят, снизу 1 провод, сверху другой, поршнем прижал