コード例 #1
0
// Bonus points constructor, which allows the user to connect a custom function
//  to a bumper.
RedBotBumper::RedBotBumper(int pin, void(*functionPointer)(void))
{
  setPinChangeInterrupt(pin, WHISKER);
  pinMode(pin, INPUT_PULLUP);
  setBumpFunction(pin, functionPointer);
  _pin = pin;  // set local variable for the pin
}
コード例 #2
0
ファイル: RedBotBumper.cpp プロジェクト: ChicoSystems/SlamBot
// Bonus points constructor, which allows the user to connect a custom function
//  to a bumper.
RedBotBumper::RedBotBumper(int pin, void(*functionPointer)(void))
{
  setPinChangeInterrupt(pin, WHISKER);
  pinMode(pin, INPUT_PULLUP);
  setBumpFunction(pin, functionPointer);
}
コード例 #3
0
ファイル: RedBotBumper.cpp プロジェクト: ChicoSystems/SlamBot
// Standard class constructor, assumes that you want to halt the motors on a
//  bump. A more skilled programmer than I could figure out the error message
//  I get if I try to use the brake() function that's a part of the RedBotMotor
//  class; I worked around it by making a globally available one.
RedBotBumper::RedBotBumper(int pin)
{
  setPinChangeInterrupt(pin, WHISKER);
  pinMode(pin, INPUT_PULLUP);
  setBumpFunction(pin, &brake);
}