TestPinb/OOP/PinballMaster.cpp
void PinballMaster::CreateObjects()
//---------------------------------------------------------------------//
{
	#ifdef DEBUGMESSAGESCREATION
	LogMessage(F("PinballMaster::CreateObjects"));
	#endif

	m_Multiplex = new Multiplex(/*S0*/23, /*S1*/25, /*S2*/27,/*S3*/29, /*SIn0*/22, /*SIn1*/34, /*SIn2*/36, /*SOut0*/24, /*SOut1*/41,/*enableOut0*/1,/*enableOut1*/2);
	m_LedControl = new LedControl();

	m_TimerToShowPlayers = new Timer(1000, NULL, TimerType::continuous);

	m_MenuButton = new InputArduino(INPUT_MENU_BUTTON);
	m_UpButton = new InputArduino(INPUT_UP_BUTTON);
	m_DownButton = new InputArduino(INPUT_DOWN_BUTTON);
	m_EnterButton = new InputArduino(INPUT_ENTER_BUTTON);
	m_StartButton = new InputArduino(INPUT_START_BUTTON);

	m_MotorSR = new Output(OUTPUT_MOTOR_SR);
	m_MotorRX = new Output(OUTPUT_MOTOR_RX);

	m_LedRamp = new Output(OUTPUT_LED_RAMP);

	m_HEADLIGHT_SR = new Output(OUTPUT_SR_HEADLIGHT);
	m_HEADLIGHT_RX = new Output(OUTPUT_RX_HEADLIGHT);
	m_LockRampOn   =  new Output(OUTPUT_RAMP_LOCK_ON);
	m_LockRampOff  = new Output(OUTPUT_RAMP_LOCK_OFF);

	m_TurnFlipperOn = new Output(OUTPUT_FLIPPER_ON_5V);
	m_OutBall = new OutBall(INPUT_SW_OUTBALL1, OUTPUT_OUTBALL1_48V, INPUT_SW_OUTBALL2, OUTPUT_OUTBALL2_48V);
	m_Hole = new KickoutHole(INPUT_SW_HOLE, OUTPUT_HOLE_48V);

	new SlingShot(INPUT_SW_SLINGSHOT_LEFT1, INPUT_SW_SLINGSHOT_LEFT2, OUTPUT_SLINGSHOTLEFT_48V);
	new SlingShot(INPUT_SW_SLINGSHOT_RIGHT1, INPUT_SW_SLINGSHOT_RIGHT2, OUTPUT_SLINGSHOTRIGHT_48V);

	new Target(INPUT_SW_OUTLANE_LEFT,LED_OUTLANE_LEFT);
	new Target(INPUT_SW_RETURNBALL_LEFT,LED_RETURNBALL_LEFT);
	new Target(INPUT_SW_RETURNBALL_RIGHT,LED_RETURNBALL_RIGHT);
	new Target(INPUT_SW_OUTLANE_RIGHT,LED_OUTLANE_RIGHT);

	new Target(INPUT_SW_TARGET_GREEN1,LED_TARGET_GREEN1);
	new Target(INPUT_SW_TARGET_RED1, LED_TARGET_RED1);

	m_DropTarget5 = new DropTarget(INPUT_SW_DROPTARGET_51, INPUT_SW_DROPTARGET_52, INPUT_SW_DROPTARGET_53, INPUT_SW_DROPTARGET_54, INPUT_SW_DROPTARGET_55, OUTPUT_DROPTARGET5_48V);
	m_DropTarget5->AddLeds(LED_DROPTARGET_51, LED_DROPTARGET_52, LED_DROPTARGET_53, LED_DROPTARGET_54, LED_DROPTARGET_55);

	m_DropTarget3 = new DropTarget(INPUT_SW_DROPTARGET_31, INPUT_SW_DROPTARGET_32, INPUT_SW_DROPTARGET_33, OUTPUT_DROPTARGET3_48V);
	m_DropTarget3->AddLeds(LED_TARGET_GREEN2, LED_TARGET_YELLOW2, LED_TARGET_RED2);

	new Input(INPUT_SW_ROLLOVER_STAR_RED1);
	new Input(INPUT_SW_TARGET_RED2);
	new Input(INPUT_SW_TARGET_YELLOW2);
	new Input(INPUT_SW_TARGET_GREEN2);

	new Input(INPUT_SW_TARGET_YELLOW1);

	new Bumper(INPUT_SW_BUMPER_LEFT, OUTPUT_BUMPER_LEFT_48V, OUTPUT_LED_BUMPER_LEFT);
	new Bumper(INPUT_SW_BUMPER_CENTER, OUTPUT_BUMPER_CENTER_48V, OUTPUT_LED_BUMPER_CENTER);
	new Bumper(INPUT_SW_BUMPER_RIGHT, OUTPUT_BUMPER_RIGHT_48V, OUTPUT_LED_BUMPER_RIGHT);

	new Input(INPUT_SW_ROLLOVER_STAR_GREEN);

	new Input(INPUT_SW_ROLLOVER_LEFT);
	new Input(INPUT_SW_ROLLOVER_CENTER);
	new Input(INPUT_SW_ROLLOVER_RIGHT);

	new Input(INPUT_SW_ROLLOVER_STAR_RED2);
	new Input(INPUT_SW_SPINNER);

	new Input(INPUT_SW_RAMP_IN);
	new Input(INPUT_SW_RAMP_OUT1);
	new Input(INPUT_SW_RAMP_OUT2);

	new ReturnKickBall(INPUT_SW_OUTLANE_LEFT, OUTPUT_RETURNBALL_48V, LED_OUTLANE_LEFT);
	new AccumulatorBall(INPUT_SW_ACCBALL1, INPUT_SW_ACCBALL2, INPUT_SW_ACCBALL3, INPUT_SW_ACCBALL4, OUTPUT_ACCBALL_48V);

	Init(StatusPinball::initializing);

	printText("Pinball", "OK", 0);
	delay(200);

	Init(StatusPinball::attractmode);
}
//---------------------------------------------------------------------//
//Create all objects to Arduino Master
Create all objects to Arduino Master
Create all objects to Arduino Master
void PinballMaster::CreateObjects()
{
	#ifdef DEBUGMESSAGESCREATION
	LogMessage(F("PinballMaster::CreateObjects"));
	#endif
	m_Multiplex = new Multiplex(23, 25, 27,29, 22, 34, 36, 24, 41,1,2);
	m_LedControl = new LedControl();
	m_TimerToShowPlayers = new Timer(1000, NULL, TimerType::continuous);
	m_MenuButton = new InputArduino(INPUT_MENU_BUTTON);
	m_UpButton = new InputArduino(INPUT_UP_BUTTON);
	m_DownButton = new InputArduino(INPUT_DOWN_BUTTON);
	m_EnterButton = new InputArduino(INPUT_ENTER_BUTTON);
	m_StartButton = new InputArduino(INPUT_START_BUTTON);
	m_MotorSR = new Output(OUTPUT_MOTOR_SR);
	m_MotorRX = new Output(OUTPUT_MOTOR_RX);
	m_LedRamp = new Output(OUTPUT_LED_RAMP);
	m_HEADLIGHT_SR = new Output(OUTPUT_SR_HEADLIGHT);
	m_HEADLIGHT_RX = new Output(OUTPUT_RX_HEADLIGHT);
	m_LockRampOn   =  new Output(OUTPUT_RAMP_LOCK_ON);
	m_LockRampOff  = new Output(OUTPUT_RAMP_LOCK_OFF);
	m_TurnFlipperOn = new Output(OUTPUT_FLIPPER_ON_5V);
	m_OutBall = new OutBall(INPUT_SW_OUTBALL1, OUTPUT_OUTBALL1_48V, INPUT_SW_OUTBALL2, OUTPUT_OUTBALL2_48V);
	m_Hole = new KickoutHole(INPUT_SW_HOLE, OUTPUT_HOLE_48V);
	new SlingShot(INPUT_SW_SLINGSHOT_LEFT1, INPUT_SW_SLINGSHOT_LEFT2, OUTPUT_SLINGSHOTLEFT_48V);
	new SlingShot(INPUT_SW_SLINGSHOT_RIGHT1, INPUT_SW_SLINGSHOT_RIGHT2, OUTPUT_SLINGSHOTRIGHT_48V);
	new Target(INPUT_SW_OUTLANE_LEFT,LED_OUTLANE_LEFT);
	new Target(INPUT_SW_RETURNBALL_LEFT,LED_RETURNBALL_LEFT);
	new Target(INPUT_SW_RETURNBALL_RIGHT,LED_RETURNBALL_RIGHT);
	new Target(INPUT_SW_OUTLANE_RIGHT,LED_OUTLANE_RIGHT);
	new Target(INPUT_SW_TARGET_GREEN1,LED_TARGET_GREEN1);
	new Target(INPUT_SW_TARGET_RED1, LED_TARGET_RED1);
	m_DropTarget5 = new DropTarget(INPUT_SW_DROPTARGET_51, INPUT_SW_DROPTARGET_52, INPUT_SW_DROPTARGET_53, INPUT_SW_DROPTARGET_54, INPUT_SW_DROPTARGET_55, OUTPUT_DROPTARGET5_48V);
	m_DropTarget5->AddLeds(LED_DROPTARGET_51, LED_DROPTARGET_52, LED_DROPTARGET_53, LED_DROPTARGET_54, LED_DROPTARGET_55);
	m_DropTarget3 = new DropTarget(INPUT_SW_DROPTARGET_31, INPUT_SW_DROPTARGET_32, INPUT_SW_DROPTARGET_33, OUTPUT_DROPTARGET3_48V);
	m_DropTarget3->AddLeds(LED_TARGET_GREEN2, LED_TARGET_YELLOW2, LED_TARGET_RED2);
	new Input(INPUT_SW_ROLLOVER_STAR_RED1);
	new Input(INPUT_SW_TARGET_RED2);
	new Input(INPUT_SW_TARGET_YELLOW2);
	new Input(INPUT_SW_TARGET_GREEN2);
	new Input(INPUT_SW_TARGET_YELLOW1);
	new Bumper(INPUT_SW_BUMPER_LEFT, OUTPUT_BUMPER_LEFT_48V, OUTPUT_LED_BUMPER_LEFT);
	new Bumper(INPUT_SW_BUMPER_CENTER, OUTPUT_BUMPER_CENTER_48V, OUTPUT_LED_BUMPER_CENTER);
	new Bumper(INPUT_SW_BUMPER_RIGHT, OUTPUT_BUMPER_RIGHT_48V, OUTPUT_LED_BUMPER_RIGHT);
	new Input(INPUT_SW_ROLLOVER_STAR_GREEN);
	new Input(INPUT_SW_ROLLOVER_LEFT);
	new Input(INPUT_SW_ROLLOVER_CENTER);
	new Input(INPUT_SW_ROLLOVER_RIGHT);
	new Input(INPUT_SW_ROLLOVER_STAR_RED2);
	new Input(INPUT_SW_SPINNER);
	new Input(INPUT_SW_RAMP_IN);
	new Input(INPUT_SW_RAMP_OUT1);
	new Input(INPUT_SW_RAMP_OUT2);
	new ReturnKickBall(INPUT_SW_OUTLANE_LEFT, OUTPUT_RETURNBALL_48V, LED_OUTLANE_LEFT);
	new AccumulatorBall(INPUT_SW_ACCBALL1, INPUT_SW_ACCBALL2, INPUT_SW_ACCBALL3, INPUT_SW_ACCBALL4, OUTPUT_ACCBALL_48V);
	Init(StatusPinball::initializing);
	printText("Pinball", "OK", 0);
	delay(200);
	Init(StatusPinball::attractmode);
}
void PinballMaster :: CreateObjects ( ) { #ifdef DEBUGMESSAGESCREATION LogMessage ( F ( " " ) ) ; #endif m_Multiplex = new Multiplex ( 23 , 25 , 27 , 29 , 22 , 34 , 36 , 24 , 41 , 1 , 2 ) ; m_LedControl = new LedControl ( ) ; m_TimerToShowPlayers = new Timer ( 1000 , NULL , TimerType :: continuous ) ; m_MenuButton = new InputArduino ( INPUT_MENU_BUTTON ) ; m_UpButton = new InputArduino ( INPUT_UP_BUTTON ) ; m_DownButton = new InputArduino ( INPUT_DOWN_BUTTON ) ; m_EnterButton = new InputArduino ( INPUT_ENTER_BUTTON ) ; m_StartButton = new InputArduino ( INPUT_START_BUTTON ) ; m_MotorSR = new Output ( OUTPUT_MOTOR_SR ) ; m_MotorRX = new Output ( OUTPUT_MOTOR_RX ) ; m_LedRamp = new Output ( OUTPUT_LED_RAMP ) ; m_HEADLIGHT_SR = new Output ( OUTPUT_SR_HEADLIGHT ) ; m_HEADLIGHT_RX = new Output ( OUTPUT_RX_HEADLIGHT ) ; m_LockRampOn = new Output ( OUTPUT_RAMP_LOCK_ON ) ; m_LockRampOff = new Output ( OUTPUT_RAMP_LOCK_OFF ) ; m_TurnFlipperOn = new Output ( OUTPUT_FLIPPER_ON_5V ) ; m_OutBall = new OutBall ( INPUT_SW_OUTBALL1 , OUTPUT_OUTBALL1_48V , INPUT_SW_OUTBALL2 , OUTPUT_OUTBALL2_48V ) ; m_Hole = new KickoutHole ( INPUT_SW_HOLE , OUTPUT_HOLE_48V ) ; new SlingShot ( INPUT_SW_SLINGSHOT_LEFT1 , INPUT_SW_SLINGSHOT_LEFT2 , OUTPUT_SLINGSHOTLEFT_48V ) ; new SlingShot ( INPUT_SW_SLINGSHOT_RIGHT1 , INPUT_SW_SLINGSHOT_RIGHT2 , OUTPUT_SLINGSHOTRIGHT_48V ) ; new Target ( INPUT_SW_OUTLANE_LEFT , LED_OUTLANE_LEFT ) ; new Target ( INPUT_SW_RETURNBALL_LEFT , LED_RETURNBALL_LEFT ) ; new Target ( INPUT_SW_RETURNBALL_RIGHT , LED_RETURNBALL_RIGHT ) ; new Target ( INPUT_SW_OUTLANE_RIGHT , LED_OUTLANE_RIGHT ) ; new Target ( INPUT_SW_TARGET_GREEN1 , LED_TARGET_GREEN1 ) ; new Target ( INPUT_SW_TARGET_RED1 , LED_TARGET_RED1 ) ; m_DropTarget5 = new DropTarget ( INPUT_SW_DROPTARGET_51 , INPUT_SW_DROPTARGET_52 , INPUT_SW_DROPTARGET_53 , INPUT_SW_DROPTARGET_54 , INPUT_SW_DROPTARGET_55 , OUTPUT_DROPTARGET5_48V ) ; m_DropTarget5 -> AddLeds ( LED_DROPTARGET_51 , LED_DROPTARGET_52 , LED_DROPTARGET_53 , LED_DROPTARGET_54 , LED_DROPTARGET_55 ) ; m_DropTarget3 = new DropTarget ( INPUT_SW_DROPTARGET_31 , INPUT_SW_DROPTARGET_32 , INPUT_SW_DROPTARGET_33 , OUTPUT_DROPTARGET3_48V ) ; m_DropTarget3 -> AddLeds ( LED_TARGET_GREEN2 , LED_TARGET_YELLOW2 , LED_TARGET_RED2 ) ; new Input ( INPUT_SW_ROLLOVER_STAR_RED1 ) ; new Input ( INPUT_SW_TARGET_RED2 ) ; new Input ( INPUT_SW_TARGET_YELLOW2 ) ; new Input ( INPUT_SW_TARGET_GREEN2 ) ; new Input ( INPUT_SW_TARGET_YELLOW1 ) ; new Bumper ( INPUT_SW_BUMPER_LEFT , OUTPUT_BUMPER_LEFT_48V , OUTPUT_LED_BUMPER_LEFT ) ; new Bumper ( INPUT_SW_BUMPER_CENTER , OUTPUT_BUMPER_CENTER_48V , OUTPUT_LED_BUMPER_CENTER ) ; new Bumper ( INPUT_SW_BUMPER_RIGHT , OUTPUT_BUMPER_RIGHT_48V , OUTPUT_LED_BUMPER_RIGHT ) ; new Input ( INPUT_SW_ROLLOVER_STAR_GREEN ) ; new Input ( INPUT_SW_ROLLOVER_LEFT ) ; new Input ( INPUT_SW_ROLLOVER_CENTER ) ; new Input ( INPUT_SW_ROLLOVER_RIGHT ) ; new Input ( INPUT_SW_ROLLOVER_STAR_RED2 ) ; new Input ( INPUT_SW_SPINNER ) ; new Input ( INPUT_SW_RAMP_IN ) ; new Input ( INPUT_SW_RAMP_OUT1 ) ; new Input ( INPUT_SW_RAMP_OUT2 ) ; new ReturnKickBall ( INPUT_SW_OUTLANE_LEFT , OUTPUT_RETURNBALL_48V , LED_OUTLANE_LEFT ) ; new AccumulatorBall ( INPUT_SW_ACCBALL1 , INPUT_SW_ACCBALL2 , INPUT_SW_ACCBALL3 , INPUT_SW_ACCBALL4 , OUTPUT_ACCBALL_48V ) ; Init ( StatusPinball :: initializing ) ; printText ( " " , " " , 0 ) ; delay ( 200 ) ; Init ( StatusPinball :: attractmode ) ; }
Create all objects to Arduino Master
Create all objects to Arduino Master
//---------------------------------------------------------------------// /*S0*/ /*S1*/ /*S2*/ /*S3*/ /*SIn0*/ /*SIn1*/ /*SIn2*/ /*SOut0*/ /*SOut1*/ /*enableOut0*/ /*enableOut1*/