Dependents:   RobotBase

Robot.cpp

Committer:
inst
Date:
2015-10-14
Revision:
2:0d9bb8e1876b
Parent:
1:48028dcad4e2
Child:
3:4dbbd511a49d

File content as of revision 2:0d9bb8e1876b:

#include "mbed.h"
#include "Robot.h"
#include "I2CDevice.h"

// XBee :                       ----  1
// Steering {
//  I2CMotor * 3, I2CServo * 3  ----  6
//  ShootingSystem :
//  I2CServo * 1                ----  1
// }
// ShootingSystem {
//  Shooter:                    ----  1
//  AmmoPusher:                 ----  1
//  AmmoSupplier:               ----  1
// }
const int Robot::mNumOfI2CDevice = 12;

void Robot::update(){
    readI2CDevice();
    updateAction();
    writeI2CDevice();
}

void Robot::writeI2CDevice(){
    for ( int i = 0; i < mNumOfI2CDevice; ++i ){
        mI2CDevice[ i ]->writeI2C();
    }
}

void Robot::readI2CDevice(){
    for ( int i = 0; i < mNumOfI2CDevice; ++i ){
        mI2CDevice[ i ]->readI2C();
    }
}