-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathorb
More file actions
executable file
·32 lines (28 loc) · 818 Bytes
/
orb
File metadata and controls
executable file
·32 lines (28 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
# Set the DA Sphere (orb) to a color from this list:
# off
# black
# white
# red
# blue
# green
# yellow
# purple
# cyan
# orange
# pink
# rainbow
function set_color {
local particle_uri=https://api.particle.io/v1/devices/$PARTICLE_PHOTON_ID/color
local color=$1
curl -s $particle_uri -d access_token=$PARTICLE_API_KEY -d arg=$color > /dev/null
}
function validate_color {
if [[ $1 == "off" || $1 == "black" || $1 == "white" || $1 == "red" || $1 == "blue" || $1 == "green" || $1 == "yellow" || $1 == "purple" || $1 == "cyan" || $1 == "orange" || $1 == "pink" || $1 == "rainbow" ]] ; then
(set_color $1 &)
else
printf "'$1' is not a valid color, must be one of: {off,black,white,red,blue,green,yellow,purple,cyan,orange,pink,rainbow}\n"
exit 1
fi
}
validate_color $1