Things used in this project

Hardware components:
09590 01
LED (generic)
×4
330ohms resistor
×4
BLE Shield
×1
A000066 iso both
Arduino UNO & Genuino UNO
×1
Software apps and online services:
Ishieldicon1026
iShield

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

Credits

Img 8652 krbxfd7hzp
Victor Carreño
12 projects • 38 followers
I design and build hardware. A friend of the world 🌎. I build stuff 💻⚒.
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog