Go Down

Topic: Yun's board name (Read 1 time) previous topic - next topic

simon_schvartzman

Sorry if it has been answered before, I wasn't able to find it.

Is there anyway to read the Yun's board name from within a sketch? How?

Thanks!

federicofissore

Run the linux program "hostname"

simon_schvartzman

Federico I'm completely new to Linux, so could you be a little more explicit, like telling me where to find the "hostname" program and how to run it? Sorry if i'm being incovinient

Many thanks in advance

Jantje

run a ssh console to connect to your yun (in windows or linux use putty)
it will ask a username and password.
username is root
pasword is what you configured it like.
type hostname

Best regards
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

federicofissore

@simon, you can do what @Jantje said and you can use the Process class in a sketch and execute "hostname" like this
Code: [Select]

void runHostname() {
  Process p;
  p.begin("hostname");
  p.run();

  while (p.available()>0) {
    char c = p.read();
    Serial.print(c);
  }
  Serial.flush();
}

simon_schvartzman

Dear Jantje & Federico, many thanks for your suggestions.

For those readers as Linux illiterate as myself please find attached the whole sketch:


Go Up