I have a raspberry pi 3 model B+ and I have been trying to send a pulse to the small audio jack port, Is this the correct way please?
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.OUT)
try:
while True:
GPIO.output(21, 1)
sleep(0.5)
GPIO.output(21, 0)
sleep(0.5)
except KeyboardInterrupt:
GPIO.cleanup()
It doesn't seem to work for some reason. Could someone tell me if I am doing something wrong please?
In case it matters, when I right-click on the small speaker icon next to the clock at the top right of the screen a small menu with only two elements pops up; Analog and HDMI. By default, HDMI is selected, and it has a small checkmark next to it. I tried to switch it to Analog but didn't make a difference. Does it matter whether Analog or HDMI is selected?
EDIT (to add more details) Apologies for my ignorance, I am completely new to this. This little device is connected to another one called an injector. It connects to the injector with a 3.5in jack. What I want to do is to use a raspberry pi to connect to (and control) the injector (instead of using the device in the link above). I was told that a stereo cable (with two male 3.5in jacks) and a python script would work. I now doubt that in the sense that the audio cable shouldn't be plugged into the 3.5 port of the pi. Instead, I should probably take the audio cable and just chop off one of the two male jacks, strip the cables and the connect one of the wires to earth and the other to pin40 (or whatever pin the python script indicates) Does it make sense?. Happy to receive any comments, let me know if I am talking rubbish...
GPIO.output(pin_num, False)
and then after some time tGPIO.output(pin_num, True)
...pin_num = 40, GPIO.setmode(GPIO.BOARD), GPIO.setup(pin_num, GPIO.OUT), GPIO.output(pin_num, True)
. I believe it is the wiring I have to sort-out. I hope it makes sense! I also suspect the male-male audio cable ended up to me by some misunderstanding. It is meant to be naked on one end and male on the other If I am right. Thanks again!