Project tutorial
iShield - Hello World!

iShield - Hello World!

Hello World project to start using iShield with Arduino and the BLE Shield.

  • 1,090 views
  • 0 comments
  • 2 respects

Components and supplies

Apps and online services

About this project

dsThis is a basic project to getting started with iShield App. It's a very simple project to turn on/off 4 LED's using the buttons and switches form the App. 

For more information about iShield visit: viccarre.mx/ishield

The BLE Shield is not available in the fritzing library so in the schematic I'm connecting the LED's directly in the Arduino.
Here is the code for the project but I recomend to use the codebender example. Available in: https://codebender.cc/sketch:91208 It's available in this post.
Untitled file

Warning: Embedding code files within the project story has been deprecated. To edit this file or add more files, go to the "Software" tab. To remove this file from the story, click on it to trigger the context menu, then click the trash can button (this won't delete it from the "Software" tab).

#include <SPI.h>
#include <Nordic_nRF8001.h>
#include <RBL_nRF8001.h>
#include "iShield.h"

iShield myiShield;

int LED1 = 2;
int LED2 = 3;
int LED3 = 4;
int LED4 = 5;

void setup()
{
  	// Init. and start BLE library.
	ble_begin();
  	Serial.begin(9600); 
  	ble_set_name("BLEShield Uno");
  	
  	pinMode(LED1, OUTPUT);
  	pinMode(LED2, OUTPUT); 
  	pinMode(LED3, OUTPUT); 
  	pinMode(LED4, OUTPUT);
  	
  	digitalWrite(LED1,LOW);
  	digitalWrite(LED2,LOW);
  	
}

void loop()
{
	myiShield.getInbox();
	
	//Buttons
	if(myiShield.isButton1Pressed()){
	    digitalWrite(LED1,HIGH);
    }else{
    	digitalWrite(LED1,LOW);
    }
      
    if(myiShield.isButton2Pressed()){
	    digitalWrite(LED2,HIGH);
    }else{
    	digitalWrite(LED2,LOW);
    }
    
    //Switches
	if(myiShield.isSwitch1On()){
    	digitalWrite(LED3,HIGH);
    }else{
    	digitalWrite(LED3,LOW);
    }
    
    if(myiShield.isSwitch2On()){
    	digitalWrite(LED4,HIGH);
    }else{
    	digitalWrite(LED4,LOW);
    }
    
    
}

Code

file_14606.txtC/C++
Here is the code for the project but I recomend to use the codebender example. Available in: https://codebender.cc/sketch:91208 It's available in this post.
#include <SPI.h>
#include <Nordic_nRF8001.h>
#include <RBL_nRF8001.h>
#include "iShield.h"

iShield myiShield;

int LED1 = 2;
int LED2 = 3;
int LED3 = 4;
int LED4 = 5;

void setup()
{
  	// Init. and start BLE library.
	ble_begin();
  	Serial.begin(9600); 
  	ble_set_name("BLEShield Uno");
  	
  	pinMode(LED1, OUTPUT);
  	pinMode(LED2, OUTPUT); 
  	pinMode(LED3, OUTPUT); 
  	pinMode(LED4, OUTPUT);
  	
  	digitalWrite(LED1,LOW);
  	digitalWrite(LED2,LOW);
  	
}

void loop()
{
	myiShield.getInbox();
	
	//Buttons
	if(myiShield.isButton1Pressed()){
	    digitalWrite(LED1,HIGH);
    }else{
    	digitalWrite(LED1,LOW);
    }
      
    if(myiShield.isButton2Pressed()){
	    digitalWrite(LED2,HIGH);
    }else{
    	digitalWrite(LED2,LOW);
    }
    
    //Switches
	if(myiShield.isSwitch1On()){
    	digitalWrite(LED3,HIGH);
    }else{
    	digitalWrite(LED3,LOW);
    }
    
    if(myiShield.isSwitch2On()){
    	digitalWrite(LED4,HIGH);
    }else{
    	digitalWrite(LED4,LOW);
    }
    
    
}
LEDs.zipArduino
No preview (download only).
Codebender

Comments

Similar projects you might like

iShield and nRF8001 Breakout example

Project tutorial by Victor Carreño

  • 2,168 views
  • 0 comments
  • 8 respects

iShield Weather Station

Project tutorial by Victor Carreño

  • 6,221 views
  • 0 comments
  • 14 respects

Using iShield Gauge with potentiometer

Project tutorial by Victor Carreño

  • 1,897 views
  • 3 comments
  • 7 respects

iShield Console Chat

Project tutorial by Victor Carreño

  • 1,649 views
  • 2 comments
  • 11 respects

Hello World with Arduino/Genuino MKR1000: Relay Board and AP

Project tutorial by Sorin Trimbitas

  • 4,081 views
  • 1 comment
  • 5 respects
Add projectSign up / Login