Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by tolson on July 18, 2017, 02:19:58 PM »
Some minor things first...
1). The spec defines IDs as 'uint8_t'. Don't know why many examples are still using 'int' and have not been corrected, yet.
2). SimbleeForMobile.domain should use your own domain or other than Simblee.com's.

But your problem is you are trying to update/draw your bargraph when you are not in the screen it is in. Thus the crash.
So be sure to test that you are in the screen of the rectangle you are wanting to change.
  if (SimbleeForMobile.updatable && currentScreen == 1){
Also, be sure your coordinates don't overwrite other objects or go off screen. I moved yours bargraph down below the button.

Code: [Select]
void loop() {

  if (SimbleeForMobile.updatable && currentScreen == 1){
    SimbleeForMobile.updateRect(ss, 80, 300, 150, 50);
  }
  SimbleeForMobile.process();
}
12
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by AKotowski on July 18, 2017, 09:54:13 AM »
Here is code that has the problem.  I modified the example "TwoScreens"
I removed the comments.  Lines I added or changed are marked by //AK
Thanks for your help
Code: [Select]
#include <SimbleeForMobile.h>

int toScreen2ButtonID;

int toScreen1ButtonID;

int currentScreen;


uint8_t ss;                                                    //AK

/*
 * Traditional Arduino setup routine
 *
 * Initialize the SimbleeForMobile environment.
 */
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("Setup beginning");
 
  SimbleeForMobile.deviceName = "2 ScreensAK";                  //AK
  SimbleeForMobile.advertisementData = "Sample";

  SimbleeForMobile.domain = "twoscreensak.simblee.com";         //AK
 
  SimbleeForMobile.begin();
 
  Serial.println("Setup completed");
}

void loop() {
  // put your main code here, to run repeatedly:
  // process must be called in the loop for Simblee UI
  if (SimbleeForMobile.updatable){                                   //AK
    SimbleeForMobile.updateRect(ss, 200, 200, 100, 50);              //AK
  };                                                                 //AK
  SimbleeForMobile.process(); 
}

void SimbleeForMobile_onConnect()
{
  currentScreen = -1;
}

void SimbleeForMobile_onDisconnect()
{
}

void ui()

  if(SimbleeForMobile.screen == currentScreen) return;
 
  currentScreen = SimbleeForMobile.screen;
  switch(SimbleeForMobile.screen)
  {
    case 1:
      createScreen1();
      break;
       
    case 2:
      createScreen2();
      break;
           
   default:
      Serial.print("ui: Uknown screen requested: ");
      Serial.println(SimbleeForMobile.screen);
  }
}

void ui_event(event_t &event)
{
//  printEvent(event);
  if(event.id == toScreen1ButtonID && event.type == EVENT_RELEASE && currentScreen == 2)
  {
    SimbleeForMobile.showScreen(1);
  } else if(event.id == toScreen2ButtonID && event.type == EVENT_RELEASE && currentScreen == 1)
  {
    SimbleeForMobile.showScreen(2);
  }
}

void createScreen1()
{
  //
  // Portrait mode is the default, so that isn't required
  // here, but shown for completeness. LANDSCAPE could be
  // used for that orientation.
  //
  SimbleeForMobile.beginScreen(YELLOW, PORTRAIT);

  int textID = SimbleeForMobile.drawText(80, 60, "Screen 1", BLACK, 40);
  toScreen2ButtonID = SimbleeForMobile.drawButton(100, 200, 100, "Screen 2");

  ss = SimbleeForMobile.drawRect(200, 200, 100, 50, RED);                          //AK

  SimbleeForMobile.setEvents(toScreen2ButtonID, EVENT_RELEASE);
  SimbleeForMobile.endScreen();
}

void createScreen2()
{
  //
  // Default to Portrait orientation
  //
  SimbleeForMobile.beginScreen(WHITE);

  int textID = SimbleeForMobile.drawText(80, 60, "Screen 2", BLACK, 40);
  toScreen1ButtonID = SimbleeForMobile.drawButton(100, 200, 100, "Screen 1");

  SimbleeForMobile.setEvents(toScreen1ButtonID, EVENT_RELEASE);
  SimbleeForMobile.endScreen();
}

void printEvent(event_t &event)
{
  Serial.println("Event:");
  Serial.print("  ID: ");
  Serial.println(event.id);
 
  Serial.print("   Type: ");
  Serial.println(event.type); 

  Serial.print("   Value: ");
  Serial.println(event.value);
 
  Serial.print("   Text: ");
  Serial.println(event.text); 
 
  Serial.print("   Coords: ");
  Serial.print(event.x); 
  Serial.print(","); 
  Serial.println(event.y); 
}
13
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by tolson on July 17, 2017, 07:57:02 PM »
I would appreciate code that I can just grab and put into the IDE. As is I have to generate a bunch that I don't know if you'd do it that way.
14
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by AKotowski on July 17, 2017, 05:27:07 PM »
Thanks, good thought about index values.  Here with constant numbers:

Code: [Select]
void createDebug1Screen()
{
  SimbleeForMobile.beginScreen(WHITE, PORTRAIT);
  ssIndicatorField = SimbleeForMobile.drawRect(200, 200, 100, 50, RED);

  toHomeScreenButtonID = SimbleeForMobile.drawButton(HOME_BUTTON_LEFT_MARGIN, HOME_BUTTON_TOP_MARGIN, HOME_BUTTON_WIDTH, HOME_BUTTON_TEXT);
  SimbleeForMobile.setEvents(toHomeScreenButtonID, EVENT_RELEASE);
  SimbleeForMobile.endScreen();
}


And here is the update code:
Code: [Select]
    case DEBUG_1_SCREEN:
      if (SimbleeForMobile.updatable){
       SimbleeForMobile.updateRect(ssIndicatorField, 200, 200, 100, 50);
      };
     break;

.
This is based on the SimbleeUITest example.
ssIndicatorField is a global type uint8_t.
Same results as before:   if the updateRect is commented out the code runs indefinitely, otherwise it stops after a few seconds when the debug 1 screen is displayed.  I see a red rectangle on the screen.
15
Support / Re: OneWire
« Last post by tolson on July 17, 2017, 05:05:16 PM »
16
Just downloaded the OneWire library from the Github link you provided to compare just in case I had mods in my copy of the library. Looks like they are exactly identical. So here is output using the Github fresh install.

Only modification was to change
OneWire ds(10);
to
OneWire ds(2);

Here is the output to the Serial Monitor. Notice the temperature going up as I apply my finger to the ds18b20.

Code: [Select]

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 33 0 0 0 FF FF 1F 48 70  CRC=70
  Temperature = 25.50 Celsius, 77.90 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 33 0 0 0 FF FF 20 48 45  CRC=45
  Temperature = 25.50 Celsius, 77.90 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 33 0 0 0 FF FF 4 48 BF  CRC=BF
  Temperature = 25.50 Celsius, 77.90 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 35 0 0 0 FF FF 6 48 BD  CRC=BD
  Temperature = 26.50 Celsius, 79.70 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 37 0 0 0 FF FF 1F 49 3B  CRC=3B
  Temperature = 27.50 Celsius, 81.50 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 38 0 0 0 FF FF 45 49 51  CRC=51
  Temperature = 28.00 Celsius, 82.40 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 38 0 0 0 FF FF 28 49 82  CRC=82
  Temperature = 28.00 Celsius, 82.40 Fahrenheit
No more addresses.


ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 33 0 0 0 FF FF 1F 48 70  CRC=70
  Temperature = 25.50 Celsius, 77.90 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 33 0 0 0 FF FF 20 48 45  CRC=45
  Temperature = 25.50 Celsius, 77.90 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 33 0 0 0 FF FF 4 48 BF  CRC=BF
  Temperature = 25.50 Celsius, 77.90 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 35 0 0 0 FF FF 6 48 BD  CRC=BD
  Temperature = 26.50 Celsius, 79.70 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 37 0 0 0 FF FF 1F 49 3B  CRC=3B
  Temperature = 27.50 Celsius, 81.50 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 38 0 0 0 FF FF 45 49 51  CRC=51
  Temperature = 28.00 Celsius, 82.40 Fahrenheit
No more addresses.

ROM = 10 C1 D1 6 0 0 0 C9
  Chip = DS18S20
  Data = 1 38 0 0 0 FF FF 28 49 82  CRC=82
  Temperature = 28.00 Celsius, 82.40 Fahrenheit
No more addresses.


17
Don't know of any special one-wire library. But this script I used to test the 18B20 uses the 2.3.3 onewire library and it is still working with Arduino 1.8.1 and RFduino library 2.3.3.

I am using RFduino Pin2. The VCC for the 18B20 is the RFduino 3V pin. There is a 4.7K ohm from pin2 to the RFduino 3V pin. Do not use 5V  with RFduino.

Code: [Select]
#include <OneWire.h>
#include <RFduinoBLE.h>

// OneWire DS18S20, DS18B20, DS1822 Temperature Example
//
// http://www.pjrc.com/teensy/td_libs_OneWire.html
//
// The DallasTemperature library can do all this work for you!
// http://milesburton.com/Dallas_Temperature_Control_Library
// Thomas Olson Modified to send data via RFduino BLE.

OneWire  ds(2);  // on pin 10 (a 4.7K resistor is necessary)

void setup(void) {
 // Serial.begin(9600);
    RFduinoBLE.advertisementData = "temp";
    RFduinoBLE.deviceName = "DS18B20";
  // start the BLE stack
  RFduinoBLE.begin();
}

void loop(void) {
  byte i;
  byte present = 0;
  byte type_s;
  byte data[12];
  byte addr[8];
  float celsius, fahrenheit;
 
  if ( !ds.search(addr)) {
  //  Serial.println("No more addresses.");
   // Serial.println();
    ds.reset_search();
    delay(250);
    return;
  }
 
  Serial.print("ROM =");
  for( i = 0; i < 8; i++) {
    Serial.write(' ');
    Serial.print(addr[i], HEX);
  }

  if (OneWire::crc8(addr, 7) != addr[7]) {
      Serial.println("CRC is not valid!");
      return;
  }
  Serial.println();
 
  // the first ROM byte indicates which chip
  switch (addr[0]) {
    case 0x10:
      Serial.println("  Chip = DS18S20");  // or old DS1820
      type_s = 1;
      break;
    case 0x28:
      Serial.println("  Chip = DS18B20");
      type_s = 0;
      break;
    case 0x22:
      Serial.println("  Chip = DS1822");
      type_s = 0;
      break;
    default:
      Serial.println("Device is not a DS18x20 family device.");
      return;
  }

  ds.reset();
  ds.select(addr);
  ds.write(0x44, 1);        // start conversion, with parasite power on at the end
 
  delay(1000);     // maybe 750ms is enough, maybe not
  // we might do a ds.depower() here, but the reset will take care of it.
 
  present = ds.reset();
  ds.select(addr);   
  ds.write(0xBE);         // Read Scratchpad

 // Serial.print("  Data = ");
 // Serial.print(present, HEX);
 // Serial.print(" ");
  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data[i] = ds.read();
  //  Serial.print(data[i], HEX);
   // Serial.print(" ");
  }
//  Serial.print(" CRC=");
 // Serial.print(OneWire::crc8(data, 8), HEX);
 // Serial.println();

  // Convert the data to actual temperature
  // because the result is a 16 bit signed integer, it should
  // be stored to an "int16_t" type, which is always 16 bits
  // even when compiled on a 32 bit processor.
  int16_t raw = (data[1] << 8) | data[0];
  if (type_s) {
    raw = raw << 3; // 9 bit resolution default
    if (data[7] == 0x10) {
      // "count remain" gives full 12 bit resolution
      raw = (raw & 0xFFF0) + 12 - data[6];
    }
  } else {
    byte cfg = (data[4] & 0x60);
    // at lower res, the low bits are undefined, so let's zero them
    if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
    else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
    else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
    //// default is 12 bit resolution, 750 ms conversion time
  }
  celsius = (float)raw / 16.0;
  fahrenheit = celsius * 1.8 + 32.0;
  /*Serial.print("  Temperature = ");
  Serial.print(celsius);
  Serial.print(" Celsius, ");
  Serial.print(fahrenheit);
  Serial.println(" Fahrenheit");
  */
    RFduinoBLE.sendFloat(celsius);
}
18
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by tolson on July 17, 2017, 03:28:02 PM »
Need more info. Can't tell what you are doing with just those calls. So have to guess. For example if your ssWidth is mean to be the width of you bar indicator(assuming you are using the rectangle as a bar graph. Then perhaps you have it in the wrong location. The fifth field is the height of the rectangle. The forth field is the width of the rectangle. So, I don't, perhaps you are exceeding the range. Just guessing. How about posting a complet sketch that should work if the two lines worked. In other words, don't need the whole project... Just a test script to get just this part your project tested out.
19
Simblee For Mobile / updateRect() causes Android App to Crash
« Last post by AKotowski on July 17, 2017, 10:03:12 AM »
I writing an Android UI. Everything is working except updationg rectangles.  A single call to update a rectangle causes the app to stop with an error message on the phone.
I am using Android V 7.0, Simblee 1.1.3.  Here is the update fragment. 
Code: [Select]
      if (SimbleeForMobile.updatable){
        SimbleeForMobile.updateValue(signalField, signal_Strength*100);
//        SimbleeForMobile.updateRect(ssIndicatorField, ssindicatorX-20, ssindicatorY, int(ssLength), ssWidth);
//        SimbleeForMobile.updateRect(ssIndicator2Field, ssindicatorX-22, ssindicatorY-2, 104 , ssWidth+4);               
        SimbleeForMobile.updateColor(ssIndicator2Field, YELLOW);               
      };

If I un-comment either of the commented lines the crash occurs.

Any suggestions, comments?

THanks
20
Support / Re: hand soldering Simblee module?
« Last post by jetty on July 17, 2017, 07:23:59 AM »
Another data point.....
First, soldermask and thin (3mil) stencil, solder paste and hot air or oven would be the correct way to do it in any type of small quantity prototyping.

However, for prototyping, the following works for me, with an Othermill made board (FR1) and no soldermask, and with adjacent pads populated.

1. Limit traces internal to the IC area, or at least give good spacing to prevent bridging.

2. Inspect, remove any burrs from traces/pads.

3. Tin the pads on the pcb with a ball of solder on the iron by dragging from the outside to the inside of the IC area, the idea being to create
a "roll" of solder on each pad, visually inspect to confirm.  Do not tin the 4 large GND pads.

3. Tin the pads on the Simblee with a ball of solder on the iron by dragging from inside the IC to the outside edge, same deal, you want a "roll" of
solder on each pad, visually inspect to confirm.  Also tin the 4 large GND pads, these should only have a small amount of solder on, similar to the
amount you'd use for a 0603, you don't want a huge ball of solder preventing the chip laying flat.  I find solder on these pads helps with
surface tension / centering and attracting the chip to the board.  If you put too much on, use solder wick to remove some.

4. Apply a flux pen to the pads on the pcb only

5. Place chip (I eyeball it for centering).

6. Use hot air to heat the chip, when solder melted, push down on the chip in multiple places with tweezers, making sure it remains centered.

Then finally, I normally test chip operation for short on the power pins, programming ability and I/O pins (alternating HiGH/LOW).  If that failed, I'd pull it with hot air,
clean everything with solder wick, IPA and retest.
Pages: 1 [2] 3 4 ... 10