Skip to content

Accessing custom EV3 name in code. #260

Answered by dlech
ChrisShepherd asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Chris,

Try using this function this to get the hostname:

def hostname():
    with open('/etc/hostname') as f:
        return f.read().strip()

This assumes you used sudo ev3dev-config to give each EV3 a unique hostname.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ChrisShepherd
Comment options

Answer selected by dlech
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
platform: EV3 Issues related to LEGO MINDSTORMS EV3
2 participants