help python rockblock rockblock_recv_text.py

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
hector_alsaago
 
Posts: 1
Joined: Sat Jul 31, 2021 8:52 pm

help python rockblock rockblock_recv_text.py

Post by hector_alsaago »

hello I need help with the code rockblock_recv_text.py I am trying to get what I receive as a message to store in a .txt so far I have the following code but it fails me in the line message_received = rb.text_in ... I don't know almost anything in python If you can help me, I would be very grateful. I leave the code that I have:

Code: Select all

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# pylint: disable=wrong-import-position
import time

# CircuitPython / Blinka
import board

#uart = board.UART()
#uart.baudrate = 19200
import serial
uart = serial.Serial("/dev/serial0", 19200)

# via USB cable
# import serial
# uart = serial.Serial("/dev/ttyUSB0", 19200)

from adafruit_rockblock import RockBlock

rb = RockBlock(uart)

# 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.")

# get the text
print(rb.text_in)

from io import open

mensaje_recibido=rb.text_in
archivo_texto=open("recibido.txt","w")
archivo.write(mensaje_recibido)
archivo.close()

User avatar
adafruit_support_carter
 
Posts: 29159
Joined: Tue Nov 29, 2016 2:45 pm

Re: help python rockblock rockblock_recv_text.py

Post by adafruit_support_carter »

What is the full text of the error message you are getting?

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”