With your Smart Phone and Arduino MKR1000 Blink a LED

The idea is to test the Arduino MKR1000, controlling the on board LED from your smart phone (this case iPhone SE. Hacksterlive Bogota.

Things used in this project

Hardware components

Arduino MKR1000
Arduino MKR1000
× 1
Apple iPhone
× 1

Software apps and online services

Snappy Ubuntu Core
Snappy Ubuntu Core
Evothings Studio
Evothings Studio
Evothings Studio has a example for the ESP8266, here the code was modified for the MKR1000



Here some screen shoots of the app:



Arduino MKR1000 and Pin 6

The Arduino MKR1000 has a test LED on pin 6, it was used for this work




It uses the libs SPI and Wifi101 availables in Arduino IDE. The main idea is to set up a WiFi connection and monitoring the status using the “serial monitor”, as option there is the code to make a analog read in port A1
#include <SPI.h>
#include <WiFi101.h>

// Setup  WIFI 
char ssid[] = "xx";       //  your network SSID (name)
char pass[] = "xx";   // your network password
int status = WL_IDLE_STATUS;
WiFiServer server(80);
//int keyIndex = 0;           // your network key Index number (needed only for WEP)

//Setup your inputs and/or outputs
int ledPin = 6;

//Setup general variables
int val = 0;
int val_AnalogIn_A = 0;
int var = 0;

//Main setup section
void setup() {
  Serial.begin(9600);      // initialize serial communication

  //Setup start
  Serial.println("Setup Start, wait...");

  //setup input and output pins, this case is for Arduino MKR1000
  pinMode(ledPin, OUTPUT);    
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to Network named: ");
    Serial.println(ssid);                   // print the network name (SSID);

    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);
    // wait 10 seconds for connection:
  server.begin();                           // start the web server on port 80
  printWifiStatus();                        // you're connected now, so print out the status

void loop(void) {

  //in case you have sensors connected to Analog Input (A1 and A2) here will be read and send to the serial monitor.
  // Check if module is still connected to WiFi.
  if (WiFi.status() != WL_CONNECTED) {
    while (WiFi.status() != WL_CONNECTED) {

  WiFiClient client = server.available();

  if (client) {
    Serial.println("Client connected.");

    while (client.connected()) {
      if (client.available()) {
        char command = client.read();
        if (command == 'H') {
          digitalWrite(ledPin, HIGH);
          Serial.println("LED is now on.");
        else if (command == 'L') {
          digitalWrite(ledPin, LOW);
          Serial.println("LED is now off.");
    Serial.println("Client disconnected.");


void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println("it means:");
  Serial.println("-30 dBm Amazing");
  Serial.println("-67 dBm Very Good");
  Serial.println("-70 dBm Okay");
  Serial.println("-80 dBm Not Good");
  Serial.println(" dBm, now we have!!!");
  // print where to go in a browser:
  Serial.print("To see the app in action, use IP-Address in your Phone app GUI: ");


void read_Analog_input()
  while(var < 10)
    if (var == 0)
      Serial.println("In case to have sensors here are printed the Values in Analog Input");
  // do something repetitive x times
  val_AnalogIn_A = analogRead(A1);
  Serial.print("Analog In A1 :");

Evothing Studio Example

It is based in example from Evothings Studio for the ESP8266, and modified to have the MKR1000 running

Using Evothings Studio, create a app in order to blink a LED on MKR1000 Arduino Board, to learn about IoT — Read More

Source : With your Smart Phone and Arduino MKR1000 Blink a LED

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation, and engineering. I have a clear and simple writing style and am skilled in using infographics and diagrams. I am a great researcher and is able to present information in a well-organized and logical manner.

Scroll to Top