How to ping or get MAC Address to check if alive?

Thanks for the heads up, @Dave!

I was hoping to get Spark core to obtain connected device’s MAC address on the private network to match up a predefined list, so it can tell who is present in the house (on the network).

I have spent some time reading up on CC3000 netapp (which is not much), but find it a bit complex to simply enquire whether a local IP address exists. In order to get a report from the ping, I will have to use a callback function and the process is asynchronous. Any chance you can provide a short sample code based on the function? :stuck_out_tongue:

Hmm, sounds like an interesting project, I’m not sure how to build this offhand, I would have to dig around in the firmware a bit, but I’m guessing there should be a way to accomplish this. Maybe someone more familiar can jump in and help write up an example. Otherwise I’ll circle back when I get a chance and see what would work. :slight_smile:


1 Like

Tried figuring out how to use it…

void setup() {
int IP[4];
IP[0] = 192;
IP[1] = 168;
IP[2] = 1;
IP[3] = 1;

//netapp_ping_send(unsigned long *ip, unsigned long ulPingAttempts, unsigned long ulPingSize, unsigned long ulPingTimeout)
netapp_ping_send((unsigned long *)IP,4,4,100);


void loop() {

I posted about this over here:


@bko awesome!

I was trying hard to figure out how to get the netapp_ping_report()…



@bko has an example code working!


I just tested this with a known working and known not working address and the “success” is not if the host answers or not–just if the ping was sent (which I see going by). Id see the pings going out on my router.

The netapp_ping_report looks like it is declared wrong since it does not return the value of the struct with the data.

1 Like

I’m guessing what everyone here really nts is some kind of reduced functionality nmap (find devices and mac addresses).

I just wanted to let everyone know that I am trying to get the ping report working but it is not working yet.

Even with the ping report, you will not get the MAC address of the remote host, you get packets sent, packets received, minimum round trip time, maximum round trip time, and average round trip time.

I report back here when I get some better news.


Thank you for your help and expertise, @bko! :slight_smile:

OK, I have something that works and will get my pull request together and merge against the upcoming RSSI feature. It currently looks like this:

  unsigned long packetsReceived =,0,0,2));
  //or try 10 times instead of the default 5 
  unsigned long packetsReceived2 =,0,0,2), 10);

There are some interesting trade-offs to be made here since the local subnet is very fast (3-5ms round-trip typically) but from where I am to is 140ms round-trip, so that the timeout value has to be fairly large (500ms). There may be more work to do here to avoid cloud disconnect.

I was able to ping my iOS gizmo on the local subnet and see quick results and then put it in airplane mode and see the zero packetsReceived. I was also able to ping some well-known hosts on the broader internet.

Special thanks to @david_s5 for a boost on this one!


awesome! initial help changed into code improvement for all the :spark: owners :wink:

For those who are interested and can build locally:

Test program:

#include "application.h"

IPAddress google(74,125,225,52);
IPAddress yahoo(98,139,180,149);
IPAddress spark(62,116,130,8);

void setup() {

void loop() {
  Serial.print("G: ");
  Serial.print(" Y: ");
  Serial.print(" S: ");
  Serial.print(" Fail: ");

Printing ‘5’ for the first three meaning 5 successful pings out of 5 and 0 for the last one is correct. You may need to change the IPAddress of the fail test to something not in use on your network.


I’ve been reading the forums for anything related to MAC address, and this is the closest thread I could find, so here goes:

I need to get the MAC address of my core in order to claim it. The Wifi network I am on is MAC-address filtered. It’s a school network and I am not the administrator of it, so I can’t check the router logs to get the MAC addresses. And it seems I can’t upload sketches in any way to the core until I claim it. So at the moment, it’s a brick until I get on another network or get the MAC address so I can register it on the school network.

Any solutions? Is there something I am missing?

@tigoe, look at the documentation for the function Network.macAddress().

Besides OTA, you can also flash your Core over USB using Spark CLI. :smile:

1 Like

Do you have spark-cli installed?

We can upload a code which disables Wifi and prints out the Mac address via serial for you to record down. :wink:

@peekay123, why did you reply so fast?! :stuck_out_tongue:


What about connecting it to your mobile phone AP, androids will tell you mac address of connected devices (not sure if iPhones do or not). you could use a serial terminal to input the SSID, security and password. Just put the core in listening mode and start the terminal and type ‘w’ and follow the prompts. full instructions for connecting with the terminal can be found on the docs site…

Am i right in thinking you need to get the mac address to give to the school so they can add it to the allowed list?

1 Like

@Hootie81 you are correct in thinking that, I need the MAC address so I can register it with the school, then it’ll be allowed to connect to the network.

@peekay123 I looked at the Network API, and tried to upload via the CLI, but it wouldn’t flash the core. I assumed it was because this core is not yet registered with my account, which I can’t do until it can get on the network, which it can’t do until I get and MAC address. It’s a chicken-egg problem.

Oh also, @Hootie81, the phone app won’t recognize a core that’s not connected to the same network it’s connected to. And my device is not yet connected to that network.

The way i was suggesting you wont be able to use the phone app to connect the core.

If you turn on the ‘access point’ or ‘wifi hotspot’ on your phone and connect the core to that.

to set the SSID and password on your core you will need to use the usb port and connect with a terminal. or borrow someone elses phone and connect that to your hotspot and use it to setup the core…