Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from smbus import SMBus
- import time
- import dropbox
- #Dropbox setup
- token = "" #add dropbox API token here
- DBX = dropbox.Dropbox(token)
- #I2C setup
- addr = 0x8
- bus = SMBus(1)
- def routeProcess():
- route = bus.read(address)
- #write route to text file
- f = open("maze.txt", "w")
- f.write(route)
- f.close()
- #upload text file to Dropbox
- DBX.files_upload(stream.read(), "/maze.txt", mode=dropbox.files.WriteMode.overwrite)
- while True:
- #latch
- while True:
- #open and read file
- f = open("flagFile.txt", "r")
- flag = f.read()
- #if a symbol is detected
- if flag == "1" or flag == "2":
- bus.write_byte(addr, 0x1)
- routeProcess()
- else:
- bus.write_byte(addr, 0x0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement