Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tolson

Pages: [1] 2 3 ... 58
1
Support / Re: Simblee supply issues?
« on: October 18, 2017, 04:03:36 PM »
The above statement equals 3 to 3-1/2 MONTHS. OUCH! It's only been a month.


2
Simblee For Mobile / Re: How to read field from drawTextField
« on: October 15, 2017, 11:46:27 AM »
 To send the text field you have to hit enter in the text field in order to trigger the ui_event callback for the text field.

So, you enter in the data into your text field. Hit enter in the text field. The number gets sent to the ui_event callback where you will store it somewhere until you need it. You can then use your SEND button to initiate whatever routine you want to use to do something with the stored number/text.


3
Simblee For Mobile / Re: How to read field from drawTextField
« on: October 15, 2017, 10:41:56 AM »
Show us how you are trying to do it.

Are you trying to read back what you already outputed to a textfield?
Or are you trying to get input via a text box?

Basics are...

uint8_t myTextFieldID = drawTextField(myX, myY, myW, myNumeral);
or
uint8_t myTextFieldID = drawTextField(myX, myY, myW, myText*);

When the field is changed on the smart device the ui_event callback is triggered.
If it was the textField that changed store it's value in a global if you want to use it elsewhere.

char myTextFieldBuffer[myTextFieldBufferSIZE];

void ui_event(event_t &event)
{

  if( event.id == myTextFieldID}
    {
      strcpy(myTextFieldBuffer,  event.text);
    }

}

 OR for numerals
int16_t myTextFieldNumeral;

void ui_event(event_t &event)
{

  if( event.id == myTextFieldID}
    {
      myTextFieldNumeral = event.value;
    }

}

Or some such!

4
RFduino Libraries / Re: SBUS Library for Arduino not compiling
« on: October 11, 2017, 06:15:39 PM »
First thing is just remove the flag in the library and see what you get.

  SERIALPORT.begin(BAUDRATE);

5
RFduino Libraries / Re: SBUS Library for Arduino not compiling
« on: October 11, 2017, 03:03:14 PM »
The nRF51 hardware UART only supports 1 stop bit.

6
Support / Re: Wake not working
« on: September 25, 2017, 01:43:26 PM »
For RFduino you may have to implement Lazarus.

http://forum.rfduino.com/index.php?topic=801.0

Actually, your problem may be that you are turning the RFduino OFF while you are in an interrupt callback. So the callback never gets a chance to unblock interrupts to be looking for new interrupts, so it never sees the pinwoke interrupt. See if you can scheme a method to set a flag that tells the loop to turn off system. And then it should start up from there.

7
Support / Re: Cant get SimbleeCloud Service to work
« on: September 18, 2017, 11:45:57 AM »
Yes, Inquiring minds would like to know !! I would like to see complete written theory API instructions on this subject. Step by step instructions to follow don't sink in for me either. I need the layout.

8
Support / Re: Simblee supply issues?
« on: September 14, 2017, 07:21:16 AM »
Dang! I do not know what is going on. None of the four main suppliers have any stock. Nor does SparkFun which has been the best source for information on using the Simblee.

Could be some big company finally went into production on something really cool and sucked up all the inventory, although I would have expected that big of a deal would be done factory direct. But I am not privy to what is going on behind the scenes.

Hopefully Mouser will get resupplied first as they have the best price for small quantities.


9
Simblee For Mobile / Re: SimbleeForMobile.drawSegment does not always work
« on: September 05, 2017, 08:45:33 AM »
Hopefully, the Pros from RFdigital will address their example.

10
Simblee For Mobile / Re: Update Segments on Connection
« on: September 04, 2017, 02:53:43 PM »
When using SimbleeForMobile, and you need responsiveness to the phone you can't really use ULPDelay or even long regular Delays as it will definitely interfere with it. You need to set up a series of pseudo state machines based on millis().

You can do something like this to get your strobe feature. I'm controlling it through the PWM instead of each LED enable.

Code: [Select]
bool strobe = true;

* * *

void loop()
{
  SimbleeForMobile.process();

  ledTime(); // deal with LED strobes, etc

  if(SimbleeForMobile.connected && SimbleeForMobile.updatable)
  {
    SimbleeForMobile.updateValue(ui_segment_front, frontValue);
    SimbleeForMobile.updateValue(ui_segment, brightnessValue);
  } 
}


* * *

int ledState = HIGH;
unsigned long previousMillis = 0;
unsigned long interval = 1000; // No const cause I want to change this dynamically.
unsigned long currentMillis;

void ledTime()
{
  if(strobe){
   
    currentMillis = millis();
    if (currentMillis - previousMillis >= interval) {
      previousMillis = currentMillis;
      if (ledState == LOW) {
        ledState = HIGH;
        interval = 100;
        analogWrite(pwm_LED, brightness); // Turn ON LED
      } else {
        ledState = LOW;
        interval = 900;
        digitalWrite(pwm_LED, 0); // Turn OFF LED
      }
    }
   
  } else {
      analogWrite(pwm_LED, brightness); // no strobing
  }
}








11
Simblee For Mobile / Re: SimbleeForMobile.drawSegment does not always work
« on: September 04, 2017, 12:38:38 PM »
Sorry, I am not following your description about some other sketch. Can you provide a minimum sketch showing exactly what you are describing.

The provided minimal sketch works and does not show what you are describing. The only problem I have with your sketch is the bright red on light grey is hard on the eyes to focus.

12
Simblee For Mobile / Re: Update Segments on Connection
« on: September 04, 2017, 12:21:21 PM »
Hi hoser,

You are almost there actually.

Just a quick note. Since you have defined your LEDs I changed your CASE statement to use those definitions instead of hard coding the GPIOs there. That way I was able to change the values in the definitions to match my LED locations.

Next in your ui_event you need to capture the values for later use. I used brightnessValue and frontValue.

Then in your loop you can test for phone connected AND that the UI is updatable before updating those value. Doing this will let you disconnect and come back and your UI Segments will reflect the values in your hardware.

Also, as a side affect, the default choices upon initial start up of the app is BLUE 25%. If you have a preference for what should be the initial startup you can change that in the brightnessValue and frontValue definition.

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;

uint8_t brightnessValue;
uint8_t frontValue;

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();

  if(SimbleeForMobile.connected && SimbleeForMobile.updatable)
  {
    SimbleeForMobile.updateValue(ui_segment_front, frontValue);
    SimbleeForMobile.updateValue(ui_segment, brightnessValue);
  }
 
}

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)
  {
    brightnessValue = event.value;
    switch (brightnessValue)
    {
      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)
  {
    frontValue = event.value;
    switch (frontValue)
    {
      case 0:
        digitalWrite(LED_BLUE, HIGH);
        digitalWrite(LED_GREEN, LOW);
        digitalWrite(LED_WHITE, LOW);
        digitalWrite(LED_RED, LOW);
        digitalWrite(LED_YELLOW, LOW);
        current_LED = LED_BLUE;
        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 = LED_GREEN;
        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 = LED_WHITE;
        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 = LED_RED;
        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 = LED_YELLOW;
        break;
    }
  }
}



13
Simblee For Mobile / Re: Update Segments on Connection
« on: September 04, 2017, 10:34:56 AM »
Are you intending to use the pwm_led to modulate a common line that goes to the 5 color LEDs? Or are you meaning to have a pwm level or the active color LED independant of the others.

But, basically you need to have a onConnect routine that re-sets your various values to the display.
You might have a onDisconnect routine that saves your values, but may not be necessary.



14
RFduino Libraries / Re: RFduino Board compile error
« 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.


15
Bugs / Re: int takes 4 bytes
« on: August 29, 2017, 01:36:10 PM »
Integers on ARM Cortex M0 are 32 bits. Thus the 4 bytes.

Pages: [1] 2 3 ... 58
anything