Skip to content
Snippets Groups Projects

Bufferandcomedi

Merged Mattias Fält requested to merge bufferandcomedi into master
33 files
+ 372
240
Compare changes
  • Side-by-side
  • Inline
Files
33
+ 25
16
#On beaglebone, run:
# include("LabConnection/src/LabConnection.jl")
# using LabConnection.BeagleBone
# include("LabConnections/src/LabConnections.jl")
# using LabConnections.BeagleBone
# run_server()
using LabConnection.Computer
using LabConnections.Computer
stream = BeagleBoneStream(ip"192.168.7.2")
led1 = SysLED(1)
led2 = SysLED(2)
led3 = SysLED(3)
led4 = SysLED(4)
# Send info to steam about which inputs/otputs to initialize
# and adds a ref in motor and led to stream
init_devices!(stream, led2, led3)
init_devices!(stream, led1, led2, led3, led4)
ledon = true
for i = 1:10
set!(led2, ledon)
set!(led3, !ledon)
send!(stream) #Sends all the outputs to the stream in one atomic call
for i = 1:50
set!(led1, ledon)
set!(led2, !ledon)
set!(led3, ledon)
set!(led4, !ledon)
send(stream) #Sends all the outputs to the stream in one atomic call
#read(stream) #Sends request to read, reads all inputs
sleep(1)
sleep(0.1)
ledon = !ledon
end
for i = 1:10
send!(led2, ledon)
sleep(0.5)
send!(led3, !ledon)
#read(stream) #Sends request to read, reads all inputs
sleep(0.5)
for i = 1:40
send(led1, ledon)
sleep(0.03)
send(led2, ledon)
sleep(0.03)
send(led3, ledon)
sleep(0.03)
send(led4, ledon)
sleep(0.03)
ledon = !ledon
end
set!(led1, false)
set!(led2, false)
set!(led3, false)
send!(stream)
set!(led4, false)
send(stream)
close(stream) #Tells BeagleBone to stop listening and close outputs
Loading