arduino manager ios app and ble


i using arduino uno, nrf8001 bluefruit le breakout board , arduino manager ios.   everything in code works correctly when connected, when disconnect ipad, uno appears restarting.  or @ least runs setup again, believe restarting. 

i new arduino programming, , new app.   i know if code, or if in library/app



code: [select]
/*
 * test arduino manager ipad / iphone / mac
 *
 * simple test program show arduino manager
 * features.
 *
 * author: fabrizio boco - fabboco@gmail.com
 *
 * version: 0.1
 *
 * 06/15/2014
 *
 * rights reserved
 * 
 */

/*
*
 * ioscontroller library, ioscontrollerwifi library, ioscontrollerserial library ("the software") , related documentation ("the documentation") supplied
 * author in consideration of agreement following terms, , use or installation of software , use of documentation
 * constitutes acceptance of these terms. 
 * if not agree these terms, please not use or install software.
 * author grants personal, non-exclusive license, under author's copyrights in original software, use software.
 * except expressly stated in notice, no other rights or licenses, express or implied, granted author, including not limited
 * patent rights may infringed derivative works or other works in software may incorporated.
 * software , documentation provided author on "as is" basis.  author makes no warranties, express or implied, including without
 * limitation implied warranties of non-infringement, merchantability , fitness particular purpose, regarding software or use , operation
 * alone or in combination products. in no event shall author liable special, indirect, incidental or consequential damages (including,
 * not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) arising in way out of use,
 * reproduction , modification of software , or of documentation, caused , whether under theory of contract, tort (including negligence),
 * strict liability or otherwise, if author has been advised of possibility of such damage.
 *
 */

#include <adafruit_neopixel.h>
//#include <bounce2.h>
#include <spi.h>
#include "adafruit_ble_uart.h"
#include "ioscontrollerforbluefruit.h"
//bounce debouncerr = bounce();
//bounce debouncerb = bounce();
//bounce debouncerg = bounce();
adafruit_neopixel strip14 = adafruit_neopixel(14, 15, neo_grb + neo_khz800);
adafruit_neopixel strip25 = adafruit_neopixel(25, 16, neo_grb + neo_khz800);
int sigdelay = 1000; 
int check=0;
int red=50;
int green=0;
int blue=0;
unsigned long previousmillisr=0;
int cycle1=0;
int ledpixel =0;



ioscontrollerforbluefruit ioscontroller(&dowork,&dosync,&processincomingmessages,&processoutgoingmessages,&deviceconnected,&devicedisconnected);

void setup()
{
  serial.begin(9600);
  strip14.begin();
  strip14.show();
  strip25.begin();
  strip25.show();

  serial.println(f("setup completed"));
}

void loop() {

  ioscontroller.loop();

}


void dowork() {

  onestrip();
  flasher();
  //serial.print("red=");serial.print(red);    serial.print("green=");serial.print(green); serial.print("blue=");serial.println(blue);
}

void dosync(char *variable) {
  //serial.print("variable ");



}

void processincomingmessages(char *variable, char *value) {
  //serial.print("variable "); serial.print(variable); serial.print(" "); serial.print(" value "); serial.println(value);
  if (strcmp(variable,"test")==0) {
    check = atoi(value);
  }

  if (strcmp(variable,"color_r") == 0) {
    red = atoi(value);

  }
  if (strcmp(variable,"color_g") == 0) {
    green = atoi(value);

  }
  if (strcmp(variable,"color_b") == 0) {
    blue = atoi(value);

  }


}

void processoutgoingmessages() {


  if (check==1) {
    ioscontroller.writetxtmessage("display","on");
  }
  if (check==0) {
    ioscontroller.writetxtmessage("display","off");
  }
}

void deviceconnected() {


  serial.println(f("deviceconnected"));
}

void devicedisconnected() {


  serial.println(f("devicedisconnected"));
}

void flasher(){

  unsigned long currentmillis = millis();
  // serial.print (currentmillis - previousmillisr);serial.print (cycle1);
  if((cycle1 == 1) && (currentmillis - previousmillisr >= sigdelay))
  {
    cycle1 = 0;  // turn off
    previousmillisr = currentmillis;  // remember time
    (int i=0;i<=strip14.numpixels(); i++){
      strip14.setpixelcolor(i,red,green,blue);
    }
  }
  else if ((cycle1 == 0) && (currentmillis - previousmillisr >= sigdelay))
  {
    cycle1 = 1;  // turn on
    previousmillisr = currentmillis;   // remember time
    (int i=0;i<=strip14.numpixels(); i++){
      strip14.setpixelcolor(i,0,0,0);
    }
  }
  strip14.show();
}
void onestrip(){
  (int i=0;i<=strip25.numpixels(); i++){
    strip25.setpixelcolor(i,red,green,blue);
  }
  strip25.show();
}



Arduino Forum > Using Arduino > Programming Questions > arduino manager ios app and ble


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code