Звёздные войны на пьезопищалке WirenBoard 5

:wink:

[details=Star_Wars.js]defineVirtualDevice(“Star_Wars”, {
title: “Star Wars”,
cells: {
enabled: {
type: “switch”,
value: false
},
}
});

defineRule(“Star_Wars_on”, {
asSoonAs: function () {
return dev.Star_Wars.enabled;
},
then: function() {
runShellCommand("/mnt/data/root/Star_Wars.sh");
}
});

defineRule(“Star_Wars_off”, {
asSoonAs: function () {
return !dev.Star_Wars.enabled;
},
then: function() {
runShellCommand("");
}
});[/details]

[details=Star_Wars.sh] #!/bin/bash
#392
echo 2557544 > /sys/class/pwm/pwmchip0/pwm3/period
echo 63928 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#392
echo 2557544 > /sys/class/pwm/pwmchip0/pwm3/period
echo 63928 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#392
echo 2557544 > /sys/class/pwm/pwmchip0/pwm3/period
echo 63928 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#311
echo 3205128 > /sys/class/pwm/pwmchip0/pwm3/period
echo 80128 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
#466
echo 2127659 > /sys/class/pwm/pwmchip0/pwm3/period
echo 53191 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#392
echo 2557544 > /sys/class/pwm/pwmchip0/pwm3/period
echo 63938 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#311
echo 3205128 > /sys/class/pwm/pwmchip0/pwm3/period
echo 80128 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
#466
echo 2127659 > /sys/class/pwm/pwmchip0/pwm3/period
echo 53191 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#392
echo 2557544 > /sys/class/pwm/pwmchip0/pwm3/period
echo 63938 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.7
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.7
#587
echo 1709401 > /sys/class/pwm/pwmchip0/pwm3/period
echo 42735 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#587
echo 1709401 > /sys/class/pwm/pwmchip0/pwm3/period
echo 42735 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#587
echo 1709401 > /sys/class/pwm/pwmchip0/pwm3/period
echo 42735 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#622
echo 1612903 > /sys/class/pwm/pwmchip0/pwm3/period
echo 40322 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
#466
echo 2127659 > /sys/class/pwm/pwmchip0/pwm3/period
echo 53191 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#369
echo 2739726 > /sys/class/pwm/pwmchip0/pwm3/period
echo 68493 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#311
echo 3205128 > /sys/class/pwm/pwmchip0/pwm3/period
echo 80128 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
#466
echo 2127659 > /sys/class/pwm/pwmchip0/pwm3/period
echo 53191 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#392
echo 2557544 > /sys/class/pwm/pwmchip0/pwm3/period
echo 63938 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.7
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.7
#784
echo 1270648 > /sys/class/pwm/pwmchip0/pwm3/period
echo 31766 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#392
echo 2557544 > /sys/class/pwm/pwmchip0/pwm3/period
echo 63938 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
#392
echo 2557544 > /sys/class/pwm/pwmchip0/pwm3/period
echo 63938 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#784
echo 1270648 > /sys/class/pwm/pwmchip0/pwm3/period
echo 31766 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#739
echo 1362397 > /sys/class/pwm/pwmchip0/pwm3/period
echo 34059 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
#698
echo 1430615 > /sys/class/pwm/pwmchip0/pwm3/period
echo 35765 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#659
echo 1526717 > /sys/class/pwm/pwmchip0/pwm3/period
echo 38167 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#622
echo 1612903 > /sys/class/pwm/pwmchip0/pwm3/period
echo 40322 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#659
echo 1526717 > /sys/class/pwm/pwmchip0/pwm3/period
echo 38167 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.45
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.45
#415
echo 2392344 > /sys/class/pwm/pwmchip0/pwm3/period
echo 59808 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.15
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.15
#554
echo 1792114 > /sys/class/pwm/pwmchip0/pwm3/period
echo 44802 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#523
echo 1912045 > /sys/class/pwm/pwmchip0/pwm3/period
echo 47801 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
#493
echo 2012072 > /sys/class/pwm/pwmchip0/pwm3/period
echo 50301 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#466
echo 2127659 > /sys/class/pwm/pwmchip0/pwm3/period
echo 53191 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#440
echo 2552252 > /sys/class/pwm/pwmchip0/pwm3/period
echo 56306 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#466
echo 2127659 > /sys/class/pwm/pwmchip0/pwm3/period
echo 53191 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.45
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.45
#311
echo 3205128 > /sys/class/pwm/pwmchip0/pwm3/period
echo 80128 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.15
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.15
#369
echo 2739726 > /sys/class/pwm/pwmchip0/pwm3/period
echo 68493 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.35
#311
echo 3205128 > /sys/class/pwm/pwmchip0/pwm3/period
echo 80128 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.25
#466
echo 2127659 > /sys/class/pwm/pwmchip0/pwm3/period
echo 53191 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.1
#392
echo 2557544 > /sys/class/pwm/pwmchip0/pwm3/period
echo 63928 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.75
echo 76923076 > /sys/class/pwm/pwmchip0/pwm3/period
echo 0 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable
sleep 0.75
sleep 5[/details]

Если будет ошибка permission denied обработать dos2unix.

2 Likes