46
loading...
This website collects cookies to deliver better user experience
until sudo python3 /home/pi/slave.py; do
echo 'Python process crashed... restarting...' >&2
sleep 3
done
>&2
redirects the output from echo - stdout (standard output) command to stderr (standard error) command. Text output from the command to the shell is delivered via the stdout (standard out) stream. Error messages from the command are sent through the stderr (standard error) stream./home/pi/.bashrc
. At the bottom of this "user boot" file, we can add the command that runs foreverPy.sh
with sudo bash /home/pi/foreverPy.sh
. It's advised to add this line to the bottom of the file.chromium-browser --app=http://some-website.com --start-fullscreen
will open the chromium web browser at the desired website in fullscreen mode. And unclutter -idle 1 -root
will hide the mouse cursor after being idle for 1 second. unclutter
is a package that can be installed from any Linux flavor by calling apt-get install unclutter
.mhmms
and uhmms
were mandatory for communication, and if you don't hear mhmm
after each sentence, you would repeat the sentence until you get one, or you get bored repeating it.'temp' => 22.1, 'humid' => 79.9, 'press' => 1011.1
). Once the slave receives a message, it sends an ACK anyways so I simply access my map of answers before sending it, find the answer at the position of question (eg. I receive 'temp' and in ACK I send answer_array
at position received_value
back to the master). This way I've cut the number of packets in half and greatly reduced room for error. After each answered question, I would've refreshed my answers array with new/fresh data and always be ready to answer the next question with the latest value.buffers = []
with open("coal.jpeg", "rb") as image:
f = image.read()
b = bytearray(binascii.hexlify(f))
counter = 0
while counter < sys.getsizeof(b):
counter += 32
if not counter > sys.getsizeof(b):
buffers.append(b[counter:counter+32])
return buffers
f = open("image.jpeg", 'wb')
while time.monotonic() < start_timer + timeout:
if nrf.available():
count += 1
# retreive the received packet's payload
buffer = nrf.read() # clears flags & empties RX FIFO
bytes += buffer
f.write(binascii.unhexlify(buffer))
if count%1000 == 0:
pass
start_timer = time.monotonic() # reset timer on every RX payload
# recommended behavior is to keep in TX mode while idle
nrf.listen = False # put the nRF24L01 is in TX mode
f.close()
46