Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

add uart#1

Open
caseyjbrotherton wants to merge 2 commits intomainfrom
features/uart
Open

add uart#1
caseyjbrotherton wants to merge 2 commits intomainfrom
features/uart

Conversation

@caseyjbrotherton
Copy link
Contributor

Add write to uart and usb.
Committing changes by @Asher123456789 that did try catch, and other modifications

Add write to uart and usb. 
Committing changes by @Asher123456789 that did try catch, and other modifications
except:
sensor2Range = -1
print("{0}, {1},".format(sensor1Range, sensor2Range))
uart.write(bytearray("{0}, {1},\r\n".format(sensor1Range, sensor2Range)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why include the carriage return (\r)? Doesn't seem like the roboRIO code expects it

Comment on lines +15 to +16
sensor1Range = -2.0
sensor2Range = -2.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these just be -2 so they don't get initialized as floating point values? If something weird happens and they fall through to the UART, it'll write a long floating point to string conversion (e.g. "-2.0000000"), won't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, will change.

i2c1 = busio.I2C(board.GP5, board.GP4)
vl53_1 = adafruit_vl53l0x.VL53L0X(i2c1)
except:
print("No 1st sensor connected")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these prints get saved anywhere where we could access them later? After a match for instance

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants