Start a new topic

Mpc commands on button press?

Is there a simple solution to send linux commands on button press to a raspbian installation (Musicbox Pi)? Nextion 2.4" Touchscreen, Raspberry Pi 2, Edup wifi. Any tutorials (no standalone demos)?

The Nextion instruction set can be found here

The format returned will be in 0X65 0X00 0X02 0X01 0XFF 0XFF 0XFF where:

65 indicates touch even data being returned

00 where this is Page 0

02 where this is component ID #2

01 where the component has been pressed, 00 has been released

FF FF FF indicating the end of data marker

With this information you can now have other logic on the other end of rx/tx to respond.

Your program on the rPi will have to listen for and catch these commands and respond to them.  As far as I know the nextion to external mcu over rx/tx is in hexadecimal sent from the Nextion and received by the rPi, and in plaintext when sending from the rPi to the nextion.

Looking forward to seeing your demo.  :)

So it is possible to make my rPI listen to this serial port and
if there comes "0X65 0X00 0X02 0X01 0XFF 0XFF 0XFF" (your example)
then execute: mpc play (play music)

I wish to make a simple GUI and control my Webradio (simple first try):

My nextion panel is shipped - i havent recieved it yet :(

I am looking around the web where to start...
I am am new to Phyton and serial communication, but willing to learn :)


Login or Signup to post a comment