Hi
How could you do that from python and using a push button, you play a note or chord of sonic pi
This code is to turn on a LED (if it works):
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(23, GPIO.OUT )
while True:
input_state = GPIO.input(24)
if input_state == False:
GPIO.output(23, True) # Enciende el LED
print(‘Botón pulsado’)
time.sleep(0.3)
GPIO.output(23, False) # Apaga el LED
and this plays a note from a python script (it also works):
from subprocess import call
call([“sonic_pi”, “play :E5”])
when i add this to the led code it doesn’t work
Thanks for your attention
thanks google translate xd