--[[
---------------------------------------------------------------------------
Remote Train Control Program for Windows

© Copyright 2020 by Mark DiVecchio

	This file is part of Remote Train Control.

	Remote Train Control is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Remote Train Control is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Remote Train Control.  If not, see <http://www.gnu.org/licenses/>.

 Home Page : http://www.silogic.com/trains/RTC_Running.html
---------------------------------------------------------------------------]]
-- Semicolons are not required in Lua code
--[[---------------------------------------------------------------------------------------]]
-- Comments start with two dashes
--[[
Mulitline comments
start with two dashes and two left brackets.
They end with two right brackets. ]]

title = "Simple Example"

-- configuration variables
AutoBellWhistle = true;

require("defines");

-- Counter Labels
Counter01Label = "Whistle Counter";

--[[---------------------------------------------------------------------------------------]]
function setup(Engine, TIU)
--
print("setup : TIU " .. TIU .. " Engine " .. Engine .. " Debug " .. Debug());
StartUp(0, Engine, TIU);
Sleep(30);
Smoke(OFF, 0, Engine, TIU);
print("Trip Odometer " .. DTO(Engine, TIU));
Sleep(10);
return true;
end
--[[---------------------------------------------------------------------------------------]]
function loop(Engine, TIU)
--
print("loop : TIU " .. TIU .. " Engine " .. Engine .. " Debug " .. Debug());
Whistle(ON, 0, Engine, TIU);
Whistle(OFF, 3, Engine, TIU);
BumpCounter(COUNTER01);
Sleep(10);
return true;	-- false=do not loop, true=continue to loop
end
--[[---------------------------------------------------------------------------------------]]
function cleanup(Engine, TIU)
--
print("cleanup : TIU " .. TIU .. " Engine " .. Engine .. " Debug " .. Debug());
print("Trip Odometer " .. DTO(Engine, TIU));
ShutDown(0, Engine, TIU);
return true;
end
--[[---------------------------------------------------------------------------------------]]
function PlayBell(Eng, TIU)
	print("PlayBell(): Eng " .. Eng .. " TIU " .. TIU .. " Debug " .. Debug());
	Bell(ON, 0, Eng, TIU);
	Bell(OFF, 4, Eng, TIU);
	return true;
end
Function01Name, Function01Label = PlayBell, "Sound Bell";
--[[---------------------------------------------------------------------------------------]]
function ShowDTO(Eng, TIU)
	print("Trip Odometer " .. DTO(Eng, TIU))
	return true;
end
Function10Name, Function10Label = ShowDTO, "Trip Odometer";
--[[---------------------------------------------------------------------------------------]]
