Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't convert int to string #1

Closed
Sfrjoshpro opened this issue Jan 26, 2023 · 10 comments
Closed

Can't convert int to string #1

Sfrjoshpro opened this issue Jan 26, 2023 · 10 comments

Comments

@Sfrjoshpro
Copy link

In _send self.p_tx pin(self.pin_txd

Seems to give me this error. Been trying everything. Not sure. Can copy and paste all your code and nothing

@Sfrjoshpro
Copy link
Author

Line 40ish

@ftylitak
Copy link
Member

hello @Sfrjoshpro

it relates to the SDI12 address used. Instead of integer address, use it as string (e.x. "0")

Indeed this needs to be made more flexible.

@Sfrjoshpro
Copy link
Author

Yea this is a basic issue i tried hard coding the value and it just
Locks up my esp32 and I have to reflash the firmware

@Sfrjoshpro
Copy link
Author

I'll give ThAt a shot and report back

@Sfrjoshpro
Copy link
Author

image

@Sfrjoshpro
Copy link
Author

image
image

@Sfrjoshpro
Copy link
Author

If I pass a int tho it cause it to lock up and I have to reflash.

@ftylitak
Copy link
Member

First of all, sharing screenshots is not a very effient way to help you with code bugs. always prefer copy/pasting code in your response. Also try to write one answer each time (not multiple responses) as they are harder to track.

Any way, the code you should run is:

from microsdi12 import SDI12

sdi12 = None

try:
    sdi12 = SDI12(16,  17,  None, 2) # Pins are integers

    manufacturer = None
    model = None
    sensor_response = None
    address = "3" # Addresse are strings

    if sdi12.is_active(address):
        manufacturer, model = sdi12.get_sensor_info(address)
        response_array = sdi12.get_measurement(address)
        print(response_array)
except Exception as e:
    print("Exception while reading SDI-12 data")
finally:
    if sdi12:
        sdi12.close()

Regading the "device locking" that you mention, most likely the device that you are using is already using the UART 1 for something else. Thus, when initializing the SDI12 with UART ID 1, the device looses control. This is why i have initialized the SDI12 object with UART ID 2 at the end.

@Sfrjoshpro
Copy link
Author

Thanks and my apologies I'm new to most this GitHub stuff. I'll give that a shot thanks

@ftylitak
Copy link
Member

Closing due to inactivity. If the issue still exists, reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants