Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Using Circuit Python with RasPi and RockBlock script send me
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Using Circuit Python with RasPi and RockBlock script send me

by ChadRT78 on Fri Jul 24, 2020 2:54 pm

Hello I am attempting to use a script that I have imported to my RasPi 3b+ to work with the RockBlock unit. I only need two modifications and I have made one of them successfully but other is not working for me. I will admit that I am not a python guy and this is my first time working with Python in general. So here goes...

Code: Select all | TOGGLE FULL SIZE
#!/usr/bin/python3
import sys
# pylint: disable=wrong-import-position
import time

# CircuitPython / Blinka
import board

import serial
uart = serial.Serial("/dev/serial0", 19200)

from adafruit_rockblock import RockBlock

rb = RockBlock(uart)

# set the text
rb.out_text = sys.argv[1]

# try a satellite Short Burst Data transfer
print("Talking to satellite...")
status = rb.satellite_transfer()
# loop as needed
retry = 0
while status[0] > 8:
    time.sleep(10)
    status = rb.satellite_transfer()
    print(retry, status)
    retry += 1

print("\nDONE.")


I added the first line and I am attempting to make the body of the message able to be sent via the command line. In PHP or BASH I can accomplish this by utilizing variables. I have found nearly identical capability but implementing this is proving to be a challenge. As you can see I have "import sys" to make use of the sys.argv[x] but I need the entire string not including the file name to be sent to the RockBlock. Can anyone point me in the direction I need to be headed.

I have confirmed that leaving it the way it comes with a shebang at the top to make entry simpler. I have also made it executable and placed it into my user/bin folder for ease of operation. Then it just works.

The idea is to be able to:
Code: Select all | TOGGLE FULL SIZE
root@rockblock-pi:~# satsend This is where my message is supposed to be!


I only get a "[No payload]" in my dashboard when I try using the string from the commandline.

So last but not least I hope this is the right forum for this :)

ChadRT78
 
Posts: 3
Joined: Wed Dec 10, 2014 5:37 pm

Re: Using Circuit Python with RasPi and RockBlock script sen

by ChadRT78 on Fri Jul 24, 2020 3:45 pm

OK so I stand corrected! It does not work with the original "hello world" example. it also delivers the "no payload" I dont know where I could have gone wrong now. LOL :D

These work just fine:
rockblock_recv_text.py
rockblock_simpletest.py

and I have even in the past few minutes been able to create a few more (copy/paste coding) for signal checks, clearing the buffers etc.

Edit: When I use the rockblock_send_data.py I get the following posted to my php application on my site...
Code: Select all | TOGGLE FULL SIZE
@k~(B hello world


and

This is what shows in the dashboard of the RockBlock console...
Code: Select all | TOGGLE FULL SIZE
400800006b7e28420b00000068656c6c6f20776f726c64

ChadRT78
 
Posts: 3
Joined: Wed Dec 10, 2014 5:37 pm

Please be positive and constructive with your questions and comments.