Посмотреть код в чем проблема, Python
Добрый день.
Есть код вот такой https://github.com/sergge1/todo-sensorbtnled/blob/master/sensorbtnled.py
Код включает или отключает светодиодную ленту в зависимости от срабатывания датчиков движения.
Добавил проигрывание аудиофайла через omxplayer (смотрите строка 74), но вот почему-то при срабатывании датчика - сначала запускается аудиофайл, и только когда он закончился воспроизводится - включается лента.
Посмотрите подскажите, что сделать чтобы аудиофайл запускался параллельно с лентой, и всего один раз нужно за время работы скрипта (только при первом срабатывании)

-
Здравствуйте!
Готов помочь, обращайтесь. Сделаю быстро и качественно
-
1104 41 0 Приветствую!
Есть идея, пишите в телеграм: t.me/nacknime
-0-0-0-0-0-0-0-0
-
В My_thread объявить две переменные. played_once = False и play_music = False.
В 74 строке вместо `call(['omxplayer', ...` поставить play_music = True.
После `colorWipe(strip2, colors, 0)`
написать условие
if (not played_once) and (play_music):
call(['omxplayer', ...
play_music = False
played_once = True
Таким образом, музыка воспроизведётся один раз. После включения ленты (обновлени состояния ленты делаеться через colorWipe() ).
Но, выполнение скрипта приостановиться на время воспроизведения аудио файла. Выше написали варианты решений. Например, запустить в subprocess.
-
Current freelance projects in the category Javascript and Typescript
Website design updateIt is necessary to update the design of the existing website using HTML, CSS, JS: refresh the appearance, make it modern and responsive for mobile devices. Smooth animations and interactive elements need to be added. HTML & CSS, Javascript and Typescript ∙ 10 hours 33 minutes back ∙ 67 proposals |
Consultation and audit of the current project on Odoo 19 Community EditionWe are looking for an Odoo Developer — a solo developer with experience in Odoo 19 Community Edition, including using Claude Code. We need a specialist who has successfully implemented projects in Odoo and practical experience in development using Claude Code. Important: we only… C & C++, Javascript and Typescript ∙ 16 hours 12 minutes back ∙ 5 proposals |
Online clothing storeNeed a developer for an online clothing store Looking for an experienced developer to create a full-fledged online clothing store with a drop model of sales. What needs to be done: 6 pages: home, product, cart, checkout, account, admin panel Login via Google account Cart and… HTML & CSS, Javascript and Typescript ∙ 2 days 13 hours back ∙ 98 proposals |
Full-stack development — Amazon PPC Dashboard (Stage 1)Need a full-stack developer with experience working with Amazon API to implement Stage 1 of the internal PPC dashboard. The project is real, the data is live, everything is ready to start. Frontend prototype (5 pages, React + TypeScript): WHAT IS ALREADY READY — Frontend… Javascript and Typescript, Web Programming ∙ 5 days back ∙ 32 proposals |
Development of a photo book and photo frame constructor websiteProject Goal A modern website needs to be developed for ordering photo books, photo frames, and other personalized photo products. The main task of the project is to provide the client with the ability to independently create a ready-made layout of the product directly on the… Javascript and Typescript, Web Programming ∙ 6 days 16 hours back ∙ 99 proposals |