Commit e5f5d95e authored by Marcus Thelander Andrén's avatar Marcus Thelander Andrén
Browse files

bug in test and ip

parent bf995ec0
......@@ -44,7 +44,7 @@ function bbparse(l::Tuple)
write!(dev, command[2], command[3])
else
val = read(dev, command[2])
println("val")
println("$val")
#TODO return somewhere
end
end
......
......@@ -6,15 +6,15 @@ end
function write!(::SysLED, ind::Int32, val::Bool)
ind [1,2,3,4] && error("Invalid SysLEND ind: $ind")
filename = "/sys/class/leds/beaglebone:green:usr$(ind-1)"
file = open(filename, "w+")
filename = "/sys/class/leds/beaglebone:green:usr$(ind-1)/brightness"
file = open(filename, "r+")
write(file, val ? "1" : "0")
close(file)
return
end
function Base.read(::SysLED, ind::Int32)
ind [1,2,3,4] && error("Invalid SysLEND ind: $ind")
filename = "/sys/class/leds/beaglebone:green:usr$(ind-1)"
filename = "/sys/class/leds/beaglebone:green:usr$(ind-1)/brightness"
file = open(filename, "r")
l = readline(file, val)
(l != "1" && l != "0") && error("Invalid value \"$l\" read from SysLed")
......
include("server.jl")
stream = BeagleBoneStream(ip"127.0.0.1")
stream = BeagleBoneStream(ip"192.168.7.2")
led2 = SysLED(2)
led3 = SysLED(3)
......@@ -22,7 +22,7 @@ for i = 1:10
send!(led3, !ledon)
#read(stream) #Sends request to read, reads all inputs
sleep(0.5)
led_on = !ledon
ledon = !ledon
end
set!(led2, false)
set!(led3, false)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment