out = false
inLast = true
function onTick()
	in1 = input.getBool(1)

	if in1 then
		request = "/test?x=1"
	else
		request = "/test?x=0"
	end

	if not (in1 == inLast) then
		async.httpGet(7878, request)
	end

	output.setBool(1, out)
	inLast = in1
end

function onDraw()
	text = ""
	if out then
		text = "true"
	else
		text = "false"
	end
	screen.drawText(1, 1, text)
end

function httpReply(port, request_body, response_body)
	if response_body == "true" then
		out = true
	else
		out = false
	end

end
