-
Notifications
You must be signed in to change notification settings - Fork 5
/
blinkleds
71 lines (64 loc) · 2.52 KB
/
blinkleds
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash -u
# Script_name : blinkleds
# Author : Bert Lindeman
# Description : Have the EV3-leds blink red amber and green
# Version : v1.3
# Date : 2014-11-04
# Usage : blinkleds
# Notes : No parameters used
# Copyright : 2014 Bert Lindeman
# License : GPL-3.0+
#
#============================================================================
#
# Changelog
# Date By Description
# 20141104 BL prepare for release v1.3
# 20140906 BL o Wait a little linger at each step
# Update to kernel 3.16.1 made things FASTER
# o Set brightness to more than 1 as this NOW works.
# use to make sliding colors
# 20140826 BL o Added script header
# o Show in the terminal what is being done.
# 20160103 BL adapt to image 20151230 (change filenames)
#============================================================================
#
. /usr/local/bin/bert_ev3dev_functions
# echo " deactivate first"
echo none > /sys/class/leds/ev3\:right\:green\:ev3dev/trigger
echo none > /sys/class/leds/ev3\:right\:red\:ev3dev/trigger
echo none > /sys/class/leds/ev3\:left\:green\:ev3dev/trigger
echo none > /sys/class/leds/ev3\:left\:red\:ev3dev/trigger
OFFleds
sleep 0.5s
# red -- green
echo 255 > /sys/class/leds/ev3\:left\:red\:ev3dev/brightness
echo 255 > /sys/class/leds/ev3\:right\:green\:ev3dev/brightness
sleep 0.5s
# green -- red
echo 0 > /sys/class/leds/ev3\:left\:red\:ev3dev/brightness
echo 255 > /sys/class/leds/ev3\:right\:red\:ev3dev/brightness
echo 255 > /sys/class/leds/ev3\:left\:green\:ev3dev/brightness
echo 0 > /sys/class/leds/ev3\:right\:green\:ev3dev/brightness
sleep 0.5s
echo 255 > /sys/class/leds/ev3\:left\:red\:ev3dev/brightness
echo 0 > /sys/class/leds/ev3\:right\:red\:ev3dev/brightness
echo 0 > /sys/class/leds/ev3\:left\:green\:ev3dev/brightness
echo 255 > /sys/class/leds/ev3\:right\:green\:ev3dev/brightness
sleep 0.5s
OFFleds
echo 255 > /sys/class/leds/ev3\:left\:green\:ev3dev/brightness
echo 255 > /sys/class/leds/ev3\:right\:green\:ev3dev/brightness
sleep 1s
OFFgreen
sleep 0.25s
for (( b1=0; b1<=255; b1++ )); do
echo $b1 > /sys/class/leds/ev3\:left\:green\:ev3dev/brightness
echo $((255-$b1)) > /sys/class/leds/ev3\:left\:red\:ev3dev/brightness
echo $b1 > /sys/class/leds/ev3\:right\:red\:ev3dev/brightness
echo $((255-$b1)) > /sys/class/leds/ev3\:right\:green\:ev3dev/brightness
sleep 0.005s
done
sleep 1s
OFFleds
#