Recent Posts

Pages: 1 ... 8 9 [10]
91
Simblee For Mobile / Re: Update Segments on Connection
« Last post by AKotowski on September 04, 2017, 09:29:29 AM »
The way to do is is to update the value of the segment just after you draw it:  SimbleeForMobile.updateValue(segment, 1); .
See my post on this forum on Aug 30  http://forum.rfduino.com/index.php?topic=1804.0
92
Simblee For Mobile / Update Segments on Connection
« Last post by hoser on September 03, 2017, 09:48:50 PM »
I have created a program that has two separate segments, one with 5 segments and other with 4. The 5 value segment is used to select a different color LED (Blue, Green, Red, Yellow and White). The 4 value segment has intensity values for the LED (25%, 50%, 75%, 100%). Everything works correctly but what I am trying to do is update the selections when I reconnect to the Simblee.

For example if I have the Blue LED on with 50% intensity and close the app, the LED remains lit (which is what I want). When I reopen the app, the selections are defaulted to nothing and I would like it to automatically update the color segment to "Blue" and intensity segment to "50%". Would I use the "SimbleeForMobile_onConnect" function and a switch case based on the current selections? Also, how do you update a segment to select a value (segment is selected)? I have found many examples of updating other items but nothing for segments. I would also like to use this same method to default the selection to 100% when a new sketch is uploaded. By default, all the LEDs are off but the intensity is set to 100% even though it is not shown on the segment.

Any help is much appreciated.

Code: [Select]

#include <SimbleeForMobile.h>

const int LED_WHITE = 2;
const int LED_RED = 5;
const int LED_BLUE = 17;
const int LED_GREEN = 6;
const int LED_YELLOW = 19;
int current_LED = 0;
const int pwm_LED = 4;
volatile uint32_t brightness = 65289; // This number divided by 255 is brightness (65,000 is brightest)
uint8_t intensityText;
uint8_t frontArrayText;
uint8_t blinkSwitchText;
uint8_t ui_segment;
uint8_t ui_segment_front;


void setup()
{
  pinMode(LED_WHITE, OUTPUT);
  digitalWrite(LED_WHITE, LOW);
  pinMode(LED_RED, OUTPUT);
  digitalWrite(LED_RED, LOW);
  pinMode(LED_BLUE, OUTPUT);
  digitalWrite(LED_BLUE, LOW);
  pinMode(LED_GREEN, OUTPUT);
  digitalWrite(LED_GREEN, LOW);
  pinMode(LED_YELLOW, OUTPUT);
  digitalWrite(LED_YELLOW, LOW);
  analogWrite(pwm_LED, brightness);

  SimbleeForMobile.advertisementData = "Demo";
  SimbleeForMobile.deviceName = "LED SEL";

  SimbleeForMobile.txPowerLevel = -4;

  SimbleeForMobile.begin();
}

void loop()
{
  SimbleeForMobile.process();
}

void ui()
{
  color_t darkgray = rgb(13, 92, 199);

  uint16_t wid = SimbleeForMobile.screenWidth;
  uint16_t hgt = SimbleeForMobile.screenHeight;

  SimbleeForMobile.beginScreen(darkgray);

  frontArrayText = SimbleeForMobile.drawText(
                     (wid / 2) - 50,       // x location
                     (hgt / 2) - 200,       // y location
                     "FRONT ARRAY",           // text
                     WHITE);                // color of text

  const char* front_blue = "BLUE";
  const char* front_green = "GREEN";
  const char* front_yellow = "YELLOW";
  const char* front_red = "RED";
  const char* front_white = "WHITE";
  const char* const front_array[5] = {front_blue, front_green, front_yellow, front_red, front_white};

  ui_segment_front = SimbleeForMobile.drawSegment(
                       (wid / 2) - 150,        // x location
                       (hgt / 2) - 180,        // y location
                       300,                    // width
                       front_array,          // array
                       5,                      // count
                       WHITE);                 // color

  intensityText = SimbleeForMobile.drawText(
                    (wid / 2) - 33,         // x location
                    (hgt / 2) + 160,       // y location
                    "INTENSITY",           // text
                    WHITE);               // color of text


  const char* quarter = "25%";
  const char* half = "50%";
  const char* three_quarter = "75%";
  const char* full = "100%";
  const char* const segment_collection[4] = {quarter, half, three_quarter, full};

  ui_segment = SimbleeForMobile.drawSegment(
                 (wid / 2) - 100,        // x location
                 (hgt / 2) + 180,        // y location
                 200,                    // width
                 segment_collection,     // array
                 4,                      // count
                 WHITE);                 // color

  SimbleeForMobile.endScreen();
}

void ui_event(event_t &event)
{
  if (event.id == ui_segment)
  {
    switch (event.value)
    {
      case 0:
        brightness = 65535;
        break;
      case 1:
        brightness = 65500;
        break;
      case 2:
        brightness = 65430;
        break;
      case 3:
        brightness = 65289;
        break;
    }
    analogWrite(pwm_LED, brightness);
  }

  // Front array color selection
  if (event.id == ui_segment_front)
  {
    switch (event.value)
    {
      case 0:
        digitalWrite(LED_BLUE, HIGH);
        digitalWrite(LED_GREEN, LOW);
        digitalWrite(LED_WHITE, LOW);
        digitalWrite(LED_RED, LOW);
        digitalWrite(LED_YELLOW, LOW);
        current_LED = 17;
        break;
      case 1:
        digitalWrite(LED_BLUE, LOW);
        digitalWrite(LED_GREEN, HIGH);
        digitalWrite(LED_WHITE, LOW);
        digitalWrite(LED_RED, LOW);
        digitalWrite(LED_YELLOW, LOW);
        current_LED = 6;
        break;
      case 2:
        digitalWrite(LED_BLUE, LOW);
        digitalWrite(LED_GREEN, LOW);
        digitalWrite(LED_WHITE, HIGH);
        digitalWrite(LED_RED, LOW);
        digitalWrite(LED_YELLOW, LOW);
        current_LED = 2;
        break;
      case 3:
        digitalWrite(LED_BLUE, LOW);
        digitalWrite(LED_GREEN, LOW);
        digitalWrite(LED_WHITE, LOW);
        digitalWrite(LED_RED, HIGH);
        digitalWrite(LED_YELLOW, LOW);
        current_LED = 5;
        break;
      case 4:
        digitalWrite(LED_BLUE, LOW);
        digitalWrite(LED_GREEN, LOW);
        digitalWrite(LED_WHITE, LOW);
        digitalWrite(LED_RED, LOW);
        digitalWrite(LED_YELLOW, HIGH);
        current_LED = 19;
        break;
    }
  }
}
93
Support / Re: Cannot read I2C device inside Timer interrupt with SimbleeBLE initialized?!
« Last post by frogie on September 01, 2017, 07:53:18 AM »
After doing as much research on the Nordic forums as I could, I think this has something to do with interrupt priority inversion, something along the lines of the PPI internally used by the TWI library having a different interrupt priority if you're using the Soft Device (i.e. when radio is enabled) or not. Sadly I don't really know for sure.

In the meantime, I have gotten around the problem by delegating all my I2C operations to the main loop (using a small message queue of sorts). It means I can't really put anything else inside loop() (like main app logic) since it has to sit there and wait for messages like "Read Accelerator". A small inconvenience but I don't know of a better way right now.

I still would like to know for sure what exactly is going on though!
94
Getting Started / Re: Arduino IDE compile error - core.a: No such file or directory
« Last post by Wayne on August 31, 2017, 10:08:57 AM »
I was curious about the 1.8.7 stuff. As it turns out it is an Windows App Store store app.  It shows up as 1.8.4 when launched.

I rather do the desktop one, much quicker to load and no windows hassle.

I suggest killing the windows app one and get the original from arduino.cc
95
RFduino Libraries / Re: RFduino Board compile error
« Last post by tolson on August 31, 2017, 09:26:15 AM »
Just yesterday, compiling and uploading codes from my PC to the RFduino module is flawless. But this day Aug 31, 2017. I can't seem to compile any code to RFduino module. I even tried the most basic examples for RFduino. Here is the Error Log:

Arduino: 1.8.4 (Windows 10), Board: "RFduino"

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86

HINT: Maybe? What is ArduinoIDE_1.8.7.0_x86. Surely not Arduino 1.8.4.

96
Yes, and they're also used for UART, but if you don't use UART they can be used as GPIOs.
In my setup I only have those pins easily accessible to hook up to a scope (and check whether the main loop() is still running) so that's why I use them.
I also use I2C on specific pins (21, 24), again because of the specific layout of the board I'm working with. Neither of these *should* have any impact though.
97
RFduino Libraries / RFduino Board compile error
« Last post by Deaniesaur on August 31, 2017, 01:21:27 AM »
Just yesterday, compiling and uploading codes from my PC to the RFduino module is flawless. But this day Aug 31, 2017. I can't seem to compile any code to RFduino module. I even tried the most basic examples for RFduino. Here is the Error Log:

Arduino: 1.8.4 (Windows 10), Board: "RFduino"

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86__mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86__mdqgnx93n4wtt\hardware -hardware C:\Users\dean_\AppData\Local\Arduino15\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86__mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\dean_\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\dean_\OneDrive\Mga Dokumento\Arduino\libraries -fqbn=RFduino:RFduino:RFduino -ide-version=10804 -build-path C:\Users\dean_\AppData\Local\Temp\arduino_build_165037 -warnings=none -build-cache C:\Users\dean_\AppData\Local\Temp\arduino_cache_758650 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\tools\arm-none-eabi-gcc\4.8.3-2014q1 -verbose G:\THESIS\Arduino\RFduino_Test\RFduino_Proto3\RFduino_Proto3.ino
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86__mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86__mdqgnx93n4wtt\hardware -hardware C:\Users\dean_\AppData\Local\Arduino15\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86__mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\dean_\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.7.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\dean_\OneDrive\Mga Dokumento\Arduino\libraries -fqbn=RFduino:RFduino:RFduino -ide-version=10804 -build-path C:\Users\dean_\AppData\Local\Temp\arduino_build_165037 -warnings=none -build-cache C:\Users\dean_\AppData\Local\Temp\arduino_cache_758650 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\tools\arm-none-eabi-gcc\4.8.3-2014q1 -verbose G:\THESIS\Arduino\RFduino_Test\RFduino_Proto3\RFduino_Proto3.ino
Using board 'RFduino' from platform in folder: C:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3
Using core 'arduino' from platform in folder: C:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3
Detecting libraries used...
"C:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fno-builtin -w -x c++ -E -CC -mcpu=cortex-m0 -DF_CPU=16000000 -DARDUINO=10804 -mthumb -D__RFduino__ "-IC:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3\cores\arduino" "-IC:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3\variants\RFduino" "-IC:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3\system/RFduino" "-IC:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3\system/RFduino/include" "-IC:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3\system/CMSIS/CMSIS/Include" "C:\Users\dean_\AppData\Local\Temp\arduino_build_165037\sketch\RFduino_Proto3.ino.cpp" -o "nul"
Generating function prototypes...
"C:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fno-builtin -w -x c++ -E -CC -mcpu=cortex-m0 -DF_CPU=16000000 -DARDUINO=10804 -mthumb -D__RFduino__ "-IC:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3\cores\arduino" "-IC:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3\variants\RFduino" "-IC:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3\system/RFduino" "-IC:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3\system/RFduino/include" "-IC:\Users\dean_\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.3\system/CMSIS/CMSIS/Include" "C:\Users\dean_\AppData\Local\Temp\arduino_build_165037\sketch\RFduino_Proto3.ino.cpp" -o "C:\Users\dean_\AppData\Local\Temp\arduino_build_165037\preproc\ctags_target_for_gcc_minus_e.cpp"
arm-none-eabi-g++: error: CreateProcess: No such file or directory

exit status 1
Error compiling for board RFduino.
98
Is GPIO pins 0,1 for serial programming.. They connect to the USB program module that way?
I never used GPIO 0 nor GPIO 1 at all.. I Leave em alone..
99
Simblee For Mobile / SimbleeForMobile.drawSegment does not always work
« Last post by AKotowski on August 30, 2017, 12:47:29 PM »
In the attached sketch, drawSegment works as expected by providing a value and highlighting the selected segment when touched.  In more complex surroundings it does not seem to work.  In  the SimbleeUITest example the Segment on the Switch/Segment screen is a solid blue bar with no text visible.  The slave segment has numbers 1 to 4.  Selecting segments on the blue bar updates the Segment display with the selected segment and clears the slave segment.  Touching the slave segment also clears the slave segment display.  The segment functions, but the display is just a solid bar.
Is this a bug in SFM, or a problem with the code?

Code: [Select]
#include <SimbleeForMobile.h>

uint8_t segment, value;

void setup() {
  // put your setup code here, to run once:
  SimbleeForMobile.deviceName = "Segment";
  SimbleeForMobile.advertisementData = "Data";
//  SimbleeForMobile.domain = "template.simblee.com";
  SimbleeForMobile.begin();
}

void loop() {
  SimbleeForMobile.process(); 
  delay(250);
}

void ui()

  SimbleeForMobile.beginScreen(GRAY, PORTRAIT);
 
  char *titles[] = { "Zero", "One", "Two", "Three", "Four" };
  segment = SimbleeForMobile.drawSegment(25, 50, 250, titles, countof(titles), RED);
  SimbleeForMobile.updateValue(segment, 1);
 
  SimbleeForMobile.drawText(50, 100, "Value:", BLACK, 14);

  value = SimbleeForMobile.drawText(150, 100, 10, BLACK, 14);

  SimbleeForMobile.setEvents(segment, EVENT_RELEASE);

  SimbleeForMobile.endScreen();
}

void ui_event(event_t &event)
{
  if (event.id == segment) {
       SimbleeForMobile.updateValue(value, event.value);
  }
}


100
Bugs / Re: Double restart when programming
« Last post by frogie on August 29, 2017, 06:20:46 PM »
I've noticed the same thing. Not a huge issue, but it annoys me too.
I do know that when you connect to the serial port, it resets the device. Maybe those two things are related?
Pages: 1 ... 8 9 [10]
anything