 		ranger: 7
 		temperature: 40
 
+	modes = {}
+
+	MODES = {
+		input: 0
+		output: 1
+	}
+
 
 	constructor: (@address, @id) ->
 		wire = new i2c @address, device: "/dev/i2c-1" 
+
 		@wire = wire  if debug.mode
 
 
-
 	send = ( cmd, port, args... ) ->
+		unless cmd is CMD.mode
+			@mode port, MODES.output
 		writeArgs = [cmd]
 		if args[1]
 			data = args[0]


		wire[readCmd] readArgs...

	write: ( type, port, data, callback ) ->
		send CMD[type].write, port, data, callback

	read: ( type, args... ) ->
		send CMD[type].read, args...

	input: (callback) ->
		wire.writeByte CMD.mode, 0, -> # Switch to input
			callback() # Do what you want
			wire.writeByte CMD.mode, 1, -> # Switch to output

	ranger: ( port, callback ) ->
		send CMD.ranger, port, [0,0], ->
			receive port, 3, (data) ->



	receive = ( port, args... ) ->
		@mode port, MODES.input
		readArgs = []
		if args[1]
			length = args[0]
