shutdown button trig a cls

This commit is contained in:
Sam 2021-04-27 02:43:12 +02:00
parent 2616fde55b
commit 7a22dc6d7f
5 changed files with 8 additions and 4 deletions

View File

@ -53,6 +53,10 @@ cd nerves
sudo cp /home/pi/nerves/autorun.conf /etc/supervisor/conf.d/ sudo cp /home/pi/nerves/autorun.conf /etc/supervisor/conf.d/
sudo supervisorctl reload sudo supervisorctl reload
to stop autorun
sudo supervisorctl stop nerves
# Based on : # Based on :
* https://www.instructables.com/Fiber-Optic-LED-Lamp/ * https://www.instructables.com/Fiber-Optic-LED-Lamp/

View File

@ -73,8 +73,10 @@ def runforever():
import os import os
print('will shutdown...') print('will shutdown...')
#sendWSall("/players Cls...")
leds.mode = -1 leds.mode = -1
leds.cls() leds.cls()
#sendWSall("/players Stopping...")
os.system("systemctl poweroff") os.system("systemctl poweroff")
sleep(0.005) sleep(0.005)

View File

@ -29,7 +29,7 @@ pixel_pin = board.D18 #(-> pin 12)
# The number of NeoPixels # The number of NeoPixels
num_pixels = 14 num_pixels = 14
palette = [(0,0,0), palette = [(255,255,255),
(255,0,0), (255,0,0),
(0,255,0), (0,255,0),
(0,0,255), (0,0,255),

View File

@ -48,8 +48,6 @@ import leds
import buttons import buttons
import ws import ws
# from Adafruit_GPIO import Platform # from Adafruit_GPIO import Platform
# print("Platform = ", Platform.platform_detect(), Platform.pi_version()) # print("Platform = ", Platform.platform_detect(), Platform.pi_version())

2
ws.py
View File

@ -143,9 +143,9 @@ def message_received(client, wserver, message):
if wspath[1] == '1': if wspath[1] == '1':
import os import os
print('will shutdown...') print('will shutdown...')
sendWSall("/players Shutdown...")
leds.mode = -1 leds.mode = -1
leds.cls() leds.cls()
sendWSall("/players Stopping...")
os.system("systemctl poweroff") os.system("systemctl poweroff")