diff --git a/Examples/tetsGPIO.jl b/Examples/tetsGPIO.jl
new file mode 100644
index 0000000000000000000000000000000000000000..76ab89703c958b54f86bb15682243e9f5b93e238
--- /dev/null
+++ b/Examples/tetsGPIO.jl
@@ -0,0 +1,12 @@
+using LabConnections.Computer
+using Sockets
+
+stream = BeagleBoneStream(ip"192.168.7.2")
+
+gpio112 = GPIO(1, true)     # Writing P9.30 (according to setup specification on BB)
+gpio66 = GPIO(29, false)    # Reading P8.7
+
+init_devices!(stream, gpio112, gpio66)
+
+send(gpio112, true)
+val = read(gpio112)
diff --git a/src/BeagleBone/BeagleBone.jl b/src/BeagleBone/BeagleBone.jl
index 0278241babc0772088dcce043a99c52f1ab0d564..db415c95304114cb39a9c48525846264ff60e334 100644
--- a/src/BeagleBone/BeagleBone.jl
+++ b/src/BeagleBone/BeagleBone.jl
@@ -1,3 +1,7 @@
+const READ = Int32(0)
+const WRITE = Int32(1)
+const INIT = Int32(2)
+
 include("IO_Object.jl")
 include("Debug.jl")
 include("SysLED.jl")
@@ -118,14 +122,14 @@ and send back on socket (vals, timestamps).
 function bbparse(l::Tuple, sock)
     operation = l[1]::Int32           #1 if write command, 0 if read, 2 if init
     ndev = l[2]::Int32              #Number of devices/commands
-    if operation == 1
+    if operation == WRITE
         for i = 1:ndev
             command = l[2+i]::Tuple
             dev = getdev(command[1], command[2])
             write!(dev, command[3])
         end
         return
-    elseif operation == 0
+    elseif operation == READ
         #TODO fix to have at least partial type stability
         vals = Array{Any,1}(undef,ndev)
         timestamps = Array{UInt64,1}(undef,ndev)
@@ -137,7 +141,7 @@ function bbparse(l::Tuple, sock)
         end
         bbsend(sock, (vals, timestamps))
         return
-    elseif operation == 2
+    elseif operation == INIT
         for i = 1:ndev
             command = l[2+i]::Tuple
             dev = initdev(command[1], command[2])
diff --git a/src/BeagleBone/GPIO.jl b/src/BeagleBone/GPIO.jl
index e016325033b215b94069c4ef1011e1feb5d64160..f71d78ff2fff8400a64f17c4b5277d61ca4dea89 100644
--- a/src/BeagleBone/GPIO.jl
+++ b/src/BeagleBone/GPIO.jl
@@ -1,3 +1,7 @@
+const GPIO_VALUE = Int32(1)
+const GPIO_DIRECTION = Int32(2)
+const GPIO_EDGE = Int32(3)
+
 """
     GPIO(i::Int32)
 Lowest form of communication with the GPIO pins. The available pins are
@@ -37,7 +41,7 @@ end
 
 # Default to writing "value"
 function write!(gpio::GPIO, val::String, debug::Bool=false)
-  write!(gpio, (Int32(1), val), debug=debug)
+  write!(gpio, (GPIO_VALUE, val), debug=debug)
 end
 
 """
@@ -60,7 +64,7 @@ end
 
 # Default to reading "value"
 function read(gpio::GPIO, debug::Bool=false)
-  read(gpio, Int32(1), debug=debug)
+  read(gpio, GPIO_VALUE, debug=debug)
 end
 """
     l = read(gpio::GPIO, operation::Int32, debug::Bool=false)
diff --git a/src/Computer/BeagleBoneStream.jl b/src/Computer/BeagleBoneStream.jl
index 1da986ba3935ef7ac6bc2e6b40e6b2ae93c3243e..ee8733094738d743d76ca17c91185ac502bccde0 100644
--- a/src/Computer/BeagleBoneStream.jl
+++ b/src/Computer/BeagleBoneStream.jl
@@ -1,5 +1,9 @@
 export BeagleBoneStream, init_devices!
 
+const BB_READ = Int32(0)
+const BB_WRITE = Int32(1)
+const BB_INIT = Int32(2)
+
 struct BeagleBoneStream <: LabStream
     devices::Array{AbstractDevice,1}
     sendbuffer::Array{Tuple,1}
@@ -26,14 +30,14 @@ function init_devices!(bbstream::BeagleBoneStream, devs::AbstractDevice...)
             readcmd = getreadcommand(bbstream, dev)
             name = readcmd[1]::String
             idx = readcmd[2]::Integer
-            serialize(bbstream.stream, (Int32(2), Int32(1), (name, Int32(idx))))
+            serialize(bbstream.stream, (BB_INIT, Int32(1), (name, Int32(idx))))
 
             setupwrite = getsetupwrite(bbstream, dev)
             if setupwrite  !== nothing
                 name = setupwrite[1]::String
                 idx = setupwrite[2]::Integer
                 commands = setupwrite[3]::Tuple
-                serialize(bbstream.stream, (Int32(1), Int32(1), (name, Int32(idx), commands)))
+                serialize(bbstream.stream, (BB_WRITE, Int32(1), (name, Int32(idx), commands)))
             end
         else
             @warn "Device $dev already added to a stream"
@@ -44,14 +48,14 @@ end
 
 function send(bbstream::BeagleBoneStream)
     ncmds = length(bbstream.sendbuffer)
-    serialize(bbstream.stream, (Int32(1), Int32(ncmds), bbstream.sendbuffer...))
+    serialize(bbstream.stream, (BB_WRITE, Int32(ncmds), bbstream.sendbuffer...))
     empty!(bbstream.sendbuffer)
     return
 end
 #TODO know the types of outputs some way
 function read(bbstream::BeagleBoneStream)
     ncmds = length(bbstream.readbuffer)
-    serialize(bbstream.stream, (Int32(0), Int32(ncmds), bbstream.readbuffer...))
+    serialize(bbstream.stream, (BB_READ, Int32(ncmds), bbstream.readbuffer...))
     empty!(bbstream.readbuffer)
     vals, timestamps = deserialize(bbstream.stream)
     length(vals) == ncmds || error("Wrong number of return values in $vals on request $(bbstream.readbuffer)")
@@ -61,13 +65,13 @@ end
 
 #The following are for interal use only
 function send(bbstream::BeagleBoneStream, cmd)
-    allcmds = (Int32(1), Int32(1), cmd)
+    allcmds = (BB_WRITE, Int32(1), cmd)
     println("Sending single command: $allcmds")
     serialize(bbstream.stream, allcmds)
     return
 end
 function read(bbstream::BeagleBoneStream, cmd)
-    allcmds = (Int32(0), Int32(1), cmd)
+    allcmds = (BB_READ, Int32(1), cmd)
     println("Sending single command: $allcmds")
     serialize(bbstream.stream, allcmds)
     vals, timestamps = deserialize(bbstream.stream)
diff --git a/src/Computer/GPIO.jl b/src/Computer/GPIO.jl
index a611e2a866946ed219ed0c0a7a421cc47ef51122..30a2216dea521c51c61f69990be22b1cc2239396 100644
--- a/src/Computer/GPIO.jl
+++ b/src/Computer/GPIO.jl
@@ -1,5 +1,8 @@
 export GPIO
 
+const GPIO_VALUE = Int32(1)
+const GPIO_DIRECTION = Int32(2)
+const GPIO_EDGE = Int32(3)
 """
 GPIO(i::Integer, direction:Bool)
 direction = true if output (write)
@@ -16,9 +19,9 @@ GPIO(i::Integer, direction::Bool) = GPIO(convert(Int32, i), direction)
 
 function getsetupwrite(stream::BeagleBoneStream, gpio::GPIO)
     if gpio.direction
-        return ("gpio", gpio.i, (Int32(2), "out"))
+        return ("gpio", gpio.i, (GPIO_DIRECTION, "out"))
     else
-        return ("gpio", gpio.i, (Int32(2), "in"))
+        return ("gpio", gpio.i, (GPIO_DIRECTION, "in"))
     end
 end
 
@@ -28,7 +31,7 @@ function getwritecommand(stream::BeagleBoneStream, gpio::GPIO, val::Bool)
         error("Can not write to GPIO input (read) device")
     end
     # TODO Check valid GPIO index
-    return ("gpio", gpio.i, (Int32(1), val ? "1" : "0"))
+    return ("gpio", gpio.i, (GPIO_VALUE, val ? "1" : "0"))
 end
 function getreadcommand(stream::BeagleBoneStream, gpio::GPIO)
     # TODO Check valid GPIO index