Skip to content
Snippets Groups Projects
Commit c0f03998 authored by Mattias Fält's avatar Mattias Fält
Browse files

Changed name to LabConnections and cleanup of files

parent 9313a009
Branches
No related tags found
No related merge requests found
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
*.jl.*.cov *.jl.*.cov
*.jl.mem *.jl.mem
*.sh~ *.sh~
*.jl~
...@@ -27,9 +27,9 @@ git: ...@@ -27,9 +27,9 @@ git:
## uncomment the following lines to override the default test script ## uncomment the following lines to override the default test script
#script: #script:
# - julia -e 'Pkg.clone(pwd()); Pkg.build("LabConnection"); Pkg.test("LabConnection"; coverage=true)' # - julia -e 'Pkg.clone(pwd()); Pkg.build("LabConnections"); Pkg.test("LabConnections"; coverage=true)'
after_success: after_success:
# push coverage results to Coveralls # push coverage results to Coveralls
- julia -e 'cd(Pkg.dir("LabConnection")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' - julia -e 'cd(Pkg.dir("LabConnections")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
# push coverage results to Codecov # push coverage results to Codecov
- julia -e 'cd(Pkg.dir("LabConnection")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' - julia -e 'cd(Pkg.dir("LabConnections")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
#On beaglebone, run: #On beaglebone, run:
# include("LabConnection/src/LabConnection.jl") # include("LabConnections/src/LabConnections.jl")
# using LabConnection.BeagleBone # using LabConnections.BeagleBone
# run_server() # run_server()
using LabConnection.Computer using LabConnections.Computer
stream = BeagleBoneStream(ip"192.168.7.2") stream = BeagleBoneStream(ip"192.168.7.2")
led1 = SysLED(1) led1 = SysLED(1)
......
The LabConnection.jl package is licensed under the MIT "Expat" License: The LabConnections.jl package is licensed under the MIT "Expat" License:
> Copyright (c) 2017: Mattias Fält. > Copyright (c) 2017: Mattias Fält.
> >
......
# LabConnection # LabConnections
[![Build Status](https://travis-ci.org/mfalt/LabConnection.jl.svg?branch=master)](https://travis-ci.org/mfalt/LabConnection.jl) [![Build Status](https://travis-ci.org/mfalt/LabConnections.jl.svg?branch=master)](https://travis-ci.org/mfalt/LabConnections.jl)
[![Coverage Status](https://coveralls.io/repos/mfalt/LabConnection.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/mfalt/LabConnection.jl?branch=master) [![Coverage Status](https://coveralls.io/repos/mfalt/LabConnections.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/mfalt/LabConnections.jl?branch=master)
[![codecov.io](http://codecov.io/github/mfalt/LabConnection.jl/coverage.svg?branch=master)](http://codecov.io/github/mfalt/LabConnection.jl?branch=master) [![codecov.io](http://codecov.io/github/mfalt/LabConnections.jl/coverage.svg?branch=master)](http://codecov.io/github/mfalt/LabConnections.jl?branch=master)
...@@ -41,7 +41,7 @@ build_script: ...@@ -41,7 +41,7 @@ build_script:
# Need to convert from shallow to complete for Pkg.clone to work # Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow) - IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo(); - C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"LabConnection\"); Pkg.build(\"LabConnection\")" Pkg.clone(pwd(), \"LabConnections\"); Pkg.build(\"LabConnections\")"
test_script: test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"LabConnection\")" - C:\projects\julia\bin\julia -e "Pkg.test(\"LabConnections\")"
__precompile__() __precompile__()
module LabConnection module LabConnections
module BeagleBone module BeagleBone
export run_server export run_server
......
include("../../src/LabConnection.jl") include("../../src/LabConnections.jl")
using LabConnection.BeagleBone using LabConnections.BeagleBone
import LabConnection.BeagleBone: getdev, write!, channels import LabConnections.BeagleBone: getdev, write!, channels
using Base.Test using Base.Test
......
include("../../src/LabConnection.jl") include("../../src/LabConnections.jl")
using LabConnection.BeagleBone using LabConnections.BeagleBone
import LabConnection.BeagleBone: getdev, write!, setup, teardown import LabConnections.BeagleBone: getdev, write!, setup, teardown
pins = Dict( pins = Dict(
"P9.22" => ("PWM0A", "pwmchip0", "0"), "P9.22" => ("PWM0A", "pwmchip0", "0"),
......
include("../../src/LabConnection.jl")
using LabConnection.BeagleBone
import LabConnection.BeagleBone: getdev, write!, setup, teardown
pins = Dict(
"P9.22" => ("PWM0A", "pwmchip0", "0"),
"P9.21" => ("PWM0B", "pwmchip0", "1"),
"P9.14" => ("PWM1A", "pwmchip0", "0"),
"P9.16" => ("PWM1B", "pwmchip0", "1"),
"P8.19" => ("PWM2A", "pwmchip0", "0"),
"P8.13" => ("PWM2B", "pwmchip0", "1"),
)
dev = getdev("pwm")
println("Running first experiment on selected pins...")
for pin in keys(pins)
println("Testing pin $(pin)")
setup(dev, pin)
write!(dev, pin, 2, "100000000")
write!(dev, pin, 3, "50000000")
write!(dev, pin, 1, "1")
sleep(1)
write!(dev, pin, 1, "0")
teardown(dev, pin)
end
println("Running second experiment on pin $(pin)...")
pin = "P9.22"
setup(dev, pin)
write!(dev, pin, 2, "1000000000")
write!(dev, pin, 3, "250000000")
write!(dev, pin, 1, "1")
sleep(5.0)
write!(dev, pin, 3, "500000000")
sleep(5.0)
write!(dev, pin, 3, "750000000")
write!(dev, pin, 1, "0")
teardown(dev, pin)
include("../../src/LabConnection.jl") include("../../src/LabConnections.jl")
using LabConnection.BeagleBone using LabConnections.BeagleBone
import LabConnection.BeagleBone: getdev, write! import LabConnections.BeagleBone: getdev, write!
using Base.Test using Base.Test
......
using LabConnection using LabConnections
using Base.Test using Base.Test
# write your own tests here # write your own tests here
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
# #
# The code may be executed from anywhere on the HOST computer. # The code may be executed from anywhere on the HOST computer.
############################################################################### ###############################################################################
ssh -t debian@192.168.7.2 "./LabConnection.jl/util/startup.sh; bash -l" ssh -t debian@192.168.7.2 "./LabConnections.jl/util/startup.sh; bash -l"
#!/bin/bash
###############################################################################
# This line of code connects to the BBB via ssh, runs the startup file and
# remains in the shell of the BBB after executing startup.sh on the BBB
#
# The code may be executed from anywhere on the HOST computer.
###############################################################################
ssh -t debian@192.168.7.2 "./LabConnection.jl/util/startup.sh; bash -l"
...@@ -8,7 +8,7 @@ printf "${BLUE}Updating project${NC}\n..." ...@@ -8,7 +8,7 @@ printf "${BLUE}Updating project${NC}\n..."
codeHost=gitlab.control.lth.se codeHost=gitlab.control.lth.se
codeUser=labdev codeUser=labdev
projects=LabConnection projects=LabConnections
flag=false flag=false
printf "${BLUE}Initializing Transferring files to BBB${NC}\n" printf "${BLUE}Initializing Transferring files to BBB${NC}\n"
......
...@@ -15,7 +15,7 @@ printf "${BLUE}Updating project${NC}\n..." ...@@ -15,7 +15,7 @@ printf "${BLUE}Updating project${NC}\n..."
codeHost=gitlab.control.lth.se codeHost=gitlab.control.lth.se
codeUser=labdev codeUser=labdev
projects=(LabConnection.jl) projects=(LabConnections.jl)
flag=false flag=false
for project in "${projects[@]}"; do for project in "${projects[@]}"; do
...@@ -63,7 +63,7 @@ done ...@@ -63,7 +63,7 @@ done
printf "${BLUE}Connecting to the BBB...${NC}\n" printf "${BLUE}Connecting to the BBB...${NC}\n"
{ {
ssh -t debian@192.168.7.2 "./LabConnection.jl/util/startup.sh; bash -l" ssh -t debian@192.168.7.2 "./LabConnections.jl/util/startup.sh; bash -l"
} || { } || {
printf "${RED}Could Connect to the BBB!${NC}\n" printf "${RED}Could Connect to the BBB!${NC}\n"
} }
#!/bin/bash
###############################################################################
# This code clones or upps the most recent code from github and transfers it to
# the BBB before connecting to it and running the startup file on the BBB.
#
# The code may be executed from anywhere on the HOST computer.
###############################################################################
BLUE='\033[0;34m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
printf "${BLUE}Updating project${NC}\n..."
codeHost=gitlab.control.lth.se
codeUser=labdev
projects=(LabConnection.jl)
flag=false
for project in "${projects[@]}"; do
{
if [ -d "${project}" ]; then
# Try to clone repository
printf "${GREEN}Pulling /${project}...${NC}\n"
cd "${project}"
echo $(ls)
git pull "https://${codeHost}/${codeUser}/${project}.git"
cd ".."
else
printf "${GREEN}Cloning /${project}...${NC}\n"
git clone "https://${codeHost}/${codeUser}/${project}.git"
fi
} || { # catch
# save log for exception
flag=false
printf "${RED}Could not udate repository /${project}${NC}, aborting.\n"
}
done
printf "${BLUE}Initializing Transferring files to BBB${NC}\n"
if [ "{flag}"=true ]; then
for project in "${projects[@]}"; do
{
printf "${GREEN}Transferring /${project}...${NC}\n"
scp -r ${project} debian@192.168.7.2:/home/debian
} || { # catch
# save log for exception
flag=false
printf "${RED}Could not send project /${project} to the BBB, aborting!${NC}\n"
}
done
fi
printf "${BLUE}Deleting temporary files...${NC}\n"
for project in "${projects[@]}"; do
{
rm -rf ${project}
} || {
printf "${RED}Could not delete project /${project}, aborting!${NC}\n"
}
done
printf "${BLUE}Connecting to the BBB...${NC}\n"
{
ssh -t debian@192.168.7.2 "./LabConnection.jl/util/startup.sh; bash -l"
} || {
printf "${RED}Could Connect to the BBB!${NC}\n"
}
#!/bin/bash
###############################################################################
# This pice of tries to scp files from the BBB to a directory $PWD/temp
#
# The code may be executed from anywhere on the HOST computer.
###############################################################################
{
if [ ! -d "temp" ]; then
mkdir temp
fi
sudo scp -r debian@192.168.7.2:/home/debian/$1 $PWD/temp
} || {
echo "Could not find or transfer $1, check that the file exists on the BBB"
}
#!/bin/sh #!/bin/sh
ls ls
cd "LabConnection.jl/test/BeagleBone" cd "LabConnections.jl/test/BeagleBone"
sudo /home/debian/julia-903644385b/bin/julia sudo /home/debian/julia-903644385b/bin/julia
#!/bin/sh
ls
cd "LabConnection.jl/test/BeagleBone"
sudo /home/debian/julia-903644385b/bin/julia
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment