public
Created

Arduino BLEShield SDK Chat_Sketch Text send 'r' BlinkM fade to 'Red' Sketch https://github.com/RedBearLab/Release/tree/master/BLEShield

  • Download Gist
BLE Shield + BlinkM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
 
#include <Arduino.h>
#include <SPI.h>
#include "ble.h"
 
#include <Wire.h>
#include "BlinkM_funcs.h"
#define blinkm_addr 0x00
void setup()
{
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(LSBFIRST);
SPI.setClockDivider(SPI_CLOCK_DIV16);
SPI.begin();
ble_begin();
Serial.begin(57600);
// blinkM Setup
pinMode(13,OUTPUT);
BlinkM_beginWithPower();
BlinkM_stopScript( blinkm_addr ); // turn off startup script
}
 
int val;
 
void loop()
{
while ( ble_available() ){
if( ble_available()>0){
val=ble_read();
}
if(val=='w'){
BlinkM_fadeToRGB(blinkm_addr,0xff,0xff,0xff);
digitalWrite(13,HIGH);
}
if(val=='r'){
BlinkM_fadeToRGB(blinkm_addr,0xff,0x00,0x00);
digitalWrite(13,HIGH);
}
if(val=='b'){
BlinkM_fadeToRGB(blinkm_addr,0x00,0x00,0x00);
digitalWrite(13,LOW);
}
}
ble_do_events();
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.