ssid board name

Silly question from an Arduino newbie

From within the program, how can I retrieve the name of the board?

Thanks

Do you mean from within your own Arduino program you have coded? or from the Arduino programming program (Arduino IDE) itself?

Maybe this link could help answer both cases :stuck_out_tongue: precompiler - determine board type of Arduino - Stack Overflow

Hi

Let me explain a bit: I have an Arduino Yun which I configure it to a certain name (see this link, search under "yun name"
http://arduino.cc/en/Guide/ArduinoYun)

Now I need a way from the program to retrieve that name so I can send an intelligent msg, e..g "this is an alert from NAME_"

Thank you for taking the time to help.

I don't think you want the SSID but here is how to get it on the Linino side:

uci get wireless.@wifi-iface[0].ssid

This will show you the ssid of the wifi network the Yun is on, if the Yun is running in AP mode, this is probably what you are looking for. If the Yun is connected to another AP, like the network in your house it will show the SSID of that network.
I think you may be looking for the hostname which the Yun uses to construct it's AP mode SSID-

hostname

will give you that.

Here is a sketch which gives you both on the Leonardo side:

#include <Process.h>

void setup() {
  // Initialize Bridge
  Bridge.begin();

  // Initialize Serial
  Serial.begin(115200);

  // Wait until a Serial Monitor is connected.
  while (!Serial);

  runGetSSID();
  runHostname();
}

void loop() {
  // Do nothing here.
}

void runHostname() {
  Process p;		// Create a process and call it "p"
  p.begin("hostname");	
  p.run();		// Run the process and wait for its termination

    while (p.available() > 0) {
    char c = p.read();
    Serial.print(c);
  }
  // Ensure the last bit of data is sent.
  Serial.flush();
}

void runGetSSID() {
  Process p;		// Create a process and call it "p"
  p.begin("uci");	
  p.addParameter("get"); 
  p.addParameter("wireless.@wifi-iface[0].ssid");
  p.run();		// Run the process and wait for its termination

  // Print command output on the Serial.
  // A process output can be read with the stream methods
  while (p.available() > 0) {
    char c = p.read();
    Serial.print(c);
  }
  // Ensure the last bit of data is sent.
  Serial.flush();
}

Hi noblepepper

Thanks for your help. Can't wait to try it out tonight.

Have a nice weekend noble pepper.