#AudioTest.py --------------------------------------------------------------------------------------------- import mplayer import time p = mplayer.Player() p.loadfile('/home/pi/Desktop/Fmp3.mp3') print("hello") time.sleep(3) #p.loadfile('/home/pi/Desktop/Fmp3.mp3') #pip install mplayer.py is what ended up working I think. Not sure if it matters that # this .py file is inside a copy of the library folder or not. # command to play from terminal: # player /home/pi/Desktop/Fmp3.mp3 #MT.py (Maestro Test) ------------------------------------------------------------------------------- import maestro import time import mplayer print("No errors?\n") servo = maestro.Controller('/dev/ttyAMA0') p = mplayer.Player() #p.loadfile('/home/pi/Desktop/Fmp3.mp3') p.loadfile('/home/pi/Desktop/mash.mp3') time.sleep(0.2) servo.runScriptSub(0) #calling another subscript while one is running does overwrite. # calling another audio does NOT overwrite #solution could be to use os.system to call an mplayer command that stops audio if there is one. time.sleep(2) #servo.runScriptSub(1) time.sleep(240) servo.close print("No errors.") #To run from console, navigate to Documents/Maestro using the cd command. #Then run it with: python3 MT.py #This was done following the piddler in the root's tutorial and taking advice from # the top comment. # Didn't require the sudo chmod command unless me doing it last boot stuck this time. # Structural code stuff --------------------------------------------------------------------------------- #Preliminary code for an outer pi, definitely not finished just an idea import time import board import digitalio import os #import pwmio #from adafruit_motor import servo from gpiozero import Servo import paho.mqtt.client as mqtt client = mqtt.Client("left") brokerAddress = "192.168.1.50" client.connect(brokerAddress) #os.system("your terminal command here") IR = digitalio.DigitalInOut(board.D26) IR.direction = digitalio.Direction.INPUT servo = Servo(16) ThermalCamOff = 1 servoPos = 0 while(True): if(ThermalCamOff): if(IR.value==1): #publish left IR trigger, need to change localhost when we get the broker set up. #os.system("mosquitto_pub -h localhost -t 'mqtt/leftsensortrig' -m '1'") client.publish("leftsensortrig", "1") #Set horizontal position to far left (colbi says bigger val = more counter clockwise) servo.value=1 time.sleep(0.8) #however long the length of time of the IR trigger is else: #if thermal cam is on servo.value = servoPos #I think to trigger the group routine, there will be a case in the middle pi that #says if both IR sensors are triggered at the same time, publish startGroupRoutine