0

how do i solve this problem?

i'm trying to play an audio file on receipt of an input with a raspberry PI 2 but it finds an error in line 13, this is the code: 1 import RPi.GPIO as GPIO 2 import vlc 3 4 Media = MediaPlayer("1.mp3") 5 6 GPIO.setmode(GPIO.BOARD) 7 8 GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) 9 10 try: 11 while true: 12 (GPIO.input(4) == 1): 13 Media.play() I don't know if there are other errors, this is the first time that I use a raspberry and that I program in python, what I wrote is a mixture of information found around so if you can explain to me how it works thank you

13th Mar 2022, 11:36 AM
Toku
1 Resposta
+ 1
I think in line 4 you should type vlc.MediaPlayer. Or import it directly: from vlc import MediaPlayer
13th Mar 2022, 11:55 AM
G B
G B - avatar