def cbButton2(button_id): sim800.speakervolume(100) sim800.stopplayback() show_screen(0x000000, 0xFFFFFF, "PLAY") a = sim800.startplayback(1, 0, 100) if not a: sim800.fsrm("REC\\1.AMR") sim800.fsrm("REC\\2.AMR") sim800.fsrm("REC\\3.AMR") load() show_screen(0x000000, 0xFFFFFF, "PLAY") sim800.startplayback(1, 0, 100)
def speakervol(): opset = [] opset.append({"title": "Silent", "index": "0"}) opset.append({"title": "Quiet", "index": "25"}) opset.append({"title": "Medium", "index": "50"}) opset.append({"title": "Loud", "index": "75"}) opset.append({"title": "Very Loud", "index": "100"}) selectedop = prompt_option(opset, text="Speaker Volume", select_text="Select", none_text="Cancel") if selectedop: sim800.speakervolume(selectedop["index"])
while (True): # Check for pairing button if (buttons.is_triggered(buttons.Buttons.BTN_1)): pairing_dialog() # Check for exit button if (buttons.is_triggered(buttons.Buttons.BTN_Menu)): sim800.btpoweroff() app.restart_to_default() num_connections = len(sim800.btconnected()) if (connected == False) and (num_connections > 0): # Gained connection ugfx.area(0, 220, 240, 320, ugfx.BLACK) #Blank bottom of screen print(sim800.btconnected()) sim800.speakervolume(100) sim800.btvoicevolume(100) ugfx.set_default_font(ugfx.FONT_TITLE) ugfx.text(5, 230, "CONNECTED!", ugfx.GREEN) ugfx.set_default_font(ugfx.FONT_SMALL) connected = True elif (connected == True) and (num_connections == 0): # Lost connection ugfx.area(0, 220, 240, 320, ugfx.BLACK) #Blank bottom of screen ugfx.set_default_font(ugfx.FONT_TITLE) ugfx.text(5, 230, "DISCONNECTED", ugfx.RED) ugfx.set_default_font(ugfx.FONT_SMALL) connected = False sleep.wfi()
def cbButtonCall(button_id): sim800.speakervolume(100) show_screen(0x000000, 0xFFFFFF, "TONE") for note, length in wilhelmus: sim800.playtone(freq.get(note, 9000), length, False)