NHK2017 octopus robot

Dependencies:   2017NHKpin_config mbed FEP ikarashiMDC PID jy901 omni HMC6352 omni_wheel

Fork of KANI2017v2 by NagaokaRoboticsClub_mbedTeam

bot/limitSwitch/limitSwitch.cpp

Committer:
number_key
Date:
2017-09-13
Revision:
23:37bb9afe9fdc
Child:
25:d199d621ecca

File content as of revision 23:37bb9afe9fdc:

#include "limitSwitch.h"

Limit::Limit(PinName limitSwitch1, PinName limitSwitch2) : frontSwitch(limitSwitch1), backSwitch(limitSwitch2)
{

    frontSwitch.rise(callback(this, &Limit::frontLimit));
    backSwitch.rise(callback(this, &Limit::backLimit));

}

void Limit::frontLimit()
{
    position = 1;
}

void Limit::backLimit()
{
    position = -1;
}

void Limit::resetPosition()
{
    position = 0;
}

int Limit::getPosition()
{
    return position;
}