<div class="highlight highlight-source-python notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#Read file plain_text = flipper.storage.read(file="/ext/foo/bar.txt") #Remove file flipper.storage.remove(file="/ext/foo/bar.txt") #Copy file flipper.storage.copy(src="/ext/foo/source.txt", dest="/ext/bar/destination.txt") #Rename file flipper.storage.rename(file="/ext/foo/bar.txt", new_file="/ext/foo/rab.txt") #MD5 Hash file md5_hash = flipper.storage.md5(file="/ext/foo/bar.txt") #Write file in one chunk file = "/ext/bar.txt" text = """There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. """ flipper.storage.write.file(file, text) #Write file using a listener file = "/ext/foo.txt" text_one = """There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. """ flipper.storage.write.start(file) time.sleep(2) flipper.storage.write.send(text_one) text_two = """All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc. “”” flipper.storage.write.send(text_two) time.sleep(3) #Don’t forget to stop flipper.storage.write.stop()”>
text = """There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. """
flipper.storage.write.file(file, text)
#Write file using a listener file = "/ext/foo.txt"
text_one = """There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. """
flipper.storage.write.start(file)
time.sleep(2)
flipper.storage.write.send(text_one)
text_two = """All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc. """ flipper.storage.write.send(text_two)
time.sleep(3)
#Don't forget to stop flipper.storage.write.stop()
LED/Backlight
#Set generic led on (r,b,g,bl) flipper.led.set(led='r', value=255)
#Read gpio pin value flipper.gpio.read(pin_name=PIN_NAME)
#Set gpio pin value flipper.gpio.mode(pin_name=PIN_NAME, value=1)
MusicPlayer
#Play song in RTTTL format rttl_song = "Littleroot Town - Pokemon:d=4,o=5,b=100:8c5,8f5,8g5,4a5,8p,8g5,8a5,8g5,8a5,8a#5,8p,4c6,8d6,8a5,8g5,8a5,8c#6,4d6,4e6,4d6,8a5,8g5,8f5,8e5,8f5,8a5,4d6,8d5,8e5,2f5,8c6,8a#5,8a#5,8a5,2f5,8d6,8a5,8a5,8g5,2f5,8p,8f5,8d5,8f5,8e5,4e5,8f5,8g5"
#Play in loop flipper.music_player.play(rtttl_code=rttl_song)
#Stop loop flipper.music_player.stop()
#Play for 20 seconds flipper.music_player.play(rtttl_code=rttl_song, duration=20)
#Beep flipper.music_player.beep()
#Beep for 5 seconds flipper.music_player.beep(duration=5)
NFC
#Synchronous default timeout 5 seconds
#Detect NFC nfc_detected = flipper.nfc.detect()
#Emulate NFC flipper.nfc.emulate()
#Activate field flipper.nfc.field()
RFID
#Synchronous default timeout 5 seconds
#Read RFID rfid = flipper.rfid.read()
SubGhz
#Transmit hex_key N times(default count = 10) flipper.subghz.tx(hex_key="DEADBEEF", frequency=433920000, count=5)
#Decode raw .sub file decoded = flipper.subghz.decode_raw(sub_file="/ext/subghz/foo.sub")
Infrared
#Transmit hex_address and hex_command selecting a protocol flipper.ir.tx(protocol="Samsung32", hex_address="C000FFEE", hex_command="DEADBEEF")