Victor Carreño
Published

iShield - Hello World!

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

Full instructions provided885
iShield - Hello World!

Things used in this project

Hardware components

LED (generic)
LED (generic)
×4
330ohms resistor
×4
BLE Shield
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1

Software apps and online services

iShield
iShield

Story

Read more

Code

file_14606.txt

C/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.zip

Arduino
No preview (download only).

Codebender

Credits

Victor Carreño

Victor Carreño

12 projects • 39 followers
I design and build hardware and software. I build stuff 💻⚒.
Contact

Comments