Recent Posts

Pages: [1] 2 3 ... 10
1
Software / CleO file write append to new line
« Last post by Chris on December 10, 2018, 03:37:43 PM »
Hi,

I'm trying to append some information to a new line within the same .txt file using the CleO file system however i seem to just be overwriting the same line each time.

Code: [Select]
#include <SPI.h>
#include <CleO.h>

void setup() {
  char STR1[] = "ABCDEFG";
  char STR2[] = "HHHHHHH";
  char STR3[] = "IIIIIII";
  int16_t actual;

  CleO.begin();

  int16_t f = CleO.FOpen("test.txt", FILE_OPEN_EXISTING | FILE_WRITE);
  CleO.FWrite(f, strlen(STR1) + 1, (uint8_t*)STR1, actual);
  CleO.FClose(f);

  CleO.FOpen("test.txt", FILE_OPEN_EXISTING | FILE_WRITE);
  CleO.FWrite(f, strlen(STR2) + 1, (uint8_t*)STR2, actual);
  CleO.FClose(f);

  CleO.FOpen("test.txt", FILE_OPEN_EXISTING | FILE_WRITE);
  CleO.FWrite(f, strlen(STR3) + 1, (uint8_t*)STR3, actual);
  CleO.FClose(f);
}

void loop() {}

I'm after a file that gives:

  ABCDEFG
  HHHHHHH
  IIIIIII

but the code above gives:

IIIIIII

Is there a way of achieving what I'm after?

thanks,

Chris
2
Software / Re: Utility Widget Keypad
« Last post by John86 on October 23, 2018, 12:07:03 PM »
Hello,

Im also trying to get the keypad to show an empty prompt. No success thou. Have you found anything or do I haveto write my own Keypad?

Kind regards
John
3
Software / Re: i2c Bridging hanging arduino
« Last post by CleOSupport on September 21, 2018, 03:46:08 PM »
Hello,

The definition for the function is as following:
   
     Command to obtain a communication handle for one of SPI, I2C, UART, GPIO, PWM and ADC

I believe it just creates the handle for communication with the given inputs, and doesn't require a response from the target device. Thus if no device is there the Handle will still be created.

Best Regards,
CleOSupport
4
Software / Re: i2c Bridging hanging arduino
« Last post by Chris on September 21, 2018, 09:31:52 AM »
Hi,

My seems to go from -420 down to -600 with my finger on the sensor.

Also should the  'HandleI2C = CleO.DeviceOpen(0, BRIDGE_TYPE_I2CM, sizeof(i2c_open_opt), (uint8_t*)&i2c_open_opt);' report back device open success if no click board is attached to the CleO?

Thanks,

Chris
5
Software / Re: i2c Bridging hanging arduino
« Last post by CleOSupport on September 20, 2018, 04:43:12 PM »
Hello Chris,

I had a quick test of you code and the Ambient Temp value sits at roughly -200, and by placing my finger onto the sensor this rises to roughly 250. Is this the behavior you are experiencing?

Best Regards,
CleOSupport
6
Software / Re: i2c Bridging hanging arduino
« Last post by Chris on September 19, 2018, 11:02:23 AM »
Hello,

The firmware upgrade has now got it working thanks!

I know its going slightly off topic but i now can't seem to get the read to work, would you be able have a look at my code please? :)
 
Code: [Select]
/*************************************************************************
  Librairies
*************************************************************************/
#include <SPI.h>
#include <CleO.h>
#include <Wire.h>


/*************************************************************************
  GLOBAL VARIABLES
*************************************************************************/
//------------------   Cleo   ----------------------
#define SCREEN_WIDTH           800
#define SCREEN_HEIGHT          480
#define CENTER_X               (0.5 * SCREEN_WIDTH)

//------------------------------------------------------

// Ir Termo click constants
#define _IR_THERMO_ADDR  0x5A
#define _AMB_TEMP        0x06
#define _OBJ_TEMP        0x07
#define MLX90614_TOBJ2 0x08
// EEPROM
#define MLX90614_TOMAX 0x20
#define MLX90614_TOMIN 0x21
#define MLX90614_PWMCTRL 0x22
#define MLX90614_TARANGE 0x23
#define EMISSIVITY 0x24
#define MLX90614_CONFIG 0x25
#define MLX90614_ADDR 0x0E
#define MLX90614_ID1 0x3C
#define MLX90614_ID2 0x3D
#define MLX90614_ID3 0x3E
#define MLX90614_ID4 0x3F


int16_t HandleI2C = -1;
int16_t BytesWritten;

int AmbientTemp;
int ObjectTemp;
char CAmbientTemp[6];
char CObjectTemp[6];



/*************************************************************************
  APPLICATION SETUP
*************************************************************************/
void setup() {

  Serial.begin(9600);

  Wire.begin();
  CleO.begin();                                     // Initiate Cleo Screen
  CleO.SetBackgroundcolor(OLDLACE);
 
  Bridge::i2cm_options i2c_open_opt;
  i2c_open_opt.SlaveAddress = 0x5A;
  i2c_open_opt.ClockSpeed = 100000;
  HandleI2C = CleO.DeviceOpen(1, BRIDGE_TYPE_I2CM, sizeof(i2c_open_opt), (uint8_t*)&i2c_open_opt);
  if (HandleI2C < 0 )
  {
    /* Failed to open a handle */
    Serial.print("DeviceOpen failed");
  }
  else
  {
    Serial.print("DeviceOpen Success");
  }
  HandleI2C = CleO.DeviceClose(HandleI2C);
}


/*************************************************************************
  MAIN APPLICATION LOOP
*************************************************************************/
void loop() {

  DrawHomeScreen();
  SensorRead();

}


/*************************************************************************
  i2c CleO Bridging
*************************************************************************/

void SensorRead() {

  Bridge::i2cm_options i2c_open_opt;
 
  i2c_open_opt.SlaveAddress = 0x5A;
  i2c_open_opt.ClockSpeed = 100000;

  HandleI2C = CleO.DeviceOpen(1, BRIDGE_TYPE_I2CM, sizeof(i2c_open_opt), (uint8_t*)&i2c_open_opt);
 
  uint8_t data[4];
  data[0] = _AMB_TEMP;
  CleO.DeviceRead(HandleI2C, 1, 1, &data[0], &data[1]);
  AmbientTemp = data[1];
  AmbientTemp |= data[1] << 8;

  AmbientTemp = (AmbientTemp * 0.02) - 273.15;

//  data[0] = _OBJ_TEMP;
//  CleO.DeviceRead(HandleI2C, 1, 1, &data[0], &data[1]);
//  ObjectTemp = data[1];
//  ObjectTemp |= data[1] << 8;
//
//  ObjectTemp = (ObjectTemp * 0.02) - 273.15;


  HandleI2C = CleO.DeviceClose(HandleI2C);

}

/*************************************************************************
  CLEO DISPLAY
*************************************************************************/
void DrawHomeScreen()
{
  CleO.Start();

  CleO.LineColor(BLACK);
  CleO.LineWidth(1);
  CleO.Line((0 * SCREEN_WIDTH), (0.03 * SCREEN_HEIGHT), (0.49 * SCREEN_WIDTH), (0.03 * SCREEN_HEIGHT));
  CleO.StringExt(FONT_SANS_4, (0.02 * SCREEN_WIDTH), (0.09 * SCREEN_HEIGHT), BLACK, ML, 0, 0, "IrThermo Click ");
  CleO.Line((0 * SCREEN_WIDTH), (0.14 * SCREEN_HEIGHT), (0.49 * SCREEN_WIDTH), (0.14 * SCREEN_HEIGHT));

  dtostrf(AmbientTemp, 4, 2, CAmbientTemp);
  CleO.Line((0.49 * SCREEN_WIDTH), (0.18 * SCREEN_HEIGHT), (0.49 * SCREEN_WIDTH), (1 * SCREEN_HEIGHT));
  CleO.RectangleExt((0 * SCREEN_WIDTH) , (0.25 * SCREEN_HEIGHT), 0.49 * SCREEN_WIDTH, 0.15 * SCREEN_HEIGHT, BLACK, ML, 0, 0);
  CleO.StringExt(FONT_SANS_3, (0.02 * SCREEN_WIDTH), (0.25 * SCREEN_HEIGHT), WHITE, ML, 0, 0, "Ambient Temp");
  CleO.StringExt(FONT_SANS_5, (0.25 * SCREEN_WIDTH), (0.46 * SCREEN_HEIGHT), BLACK, MM, 0, 0, CAmbientTemp);

  dtostrf(ObjectTemp, 4, 2, CObjectTemp);
  CleO.RectangleExt((0 * SCREEN_WIDTH), (0.66 * SCREEN_HEIGHT), 0.49 * SCREEN_WIDTH, 0.15 * SCREEN_HEIGHT, BLACK, ML, 0, 0);
  CleO.StringExt(FONT_SANS_3, (0.02 * SCREEN_WIDTH), (0.66 * SCREEN_HEIGHT), WHITE, ML, 0, 0, "Object Temp");
  CleO.StringExt(FONT_SANS_5, (0.25 * SCREEN_WIDTH), (0.87 * SCREEN_HEIGHT), BLACK, MM, 0, 0, CObjectTemp);

  CleO.Show();

}

Thanks,

Chris
7
Software / Re: i2c Bridging hanging arduino
« Last post by CleOSupport on September 18, 2018, 04:32:38 PM »
Hello Chris,

The CleO50 board I tried was using Version 2.1.0 firmware.
Could you try upgrading the firmware on your CleO to see if this helps?

The CleO PC Tools are included in the CleO_1.1.2, when installed an lauched you can use the DFU Upgrade utility.

Also can you let me know which jumpers you have populated on your CleO?

Best Regards,
CleOSupport
8
Software / Re: i2c Bridging hanging arduino
« Last post by Chris on September 18, 2018, 03:43:38 PM »
Hello,

I have two CleO50s and two Neros and I'm constantly getting:

r0=0
r1=1D7F

synced
123

The IrThermo Click works as I've had it running using the Arduino Uno Click Shield.

I've re-downloaded CleO_1.1.2  to make sure it has the most recent library.

CleO50 is running Version 2.0.0.

Thanks,

Chris
9
Software / Re: i2c Bridging hanging arduino
« Last post by CleOSupport on September 18, 2018, 03:04:30 PM »
Hello Chris,

I have just tried your code on a Cleo50 and IrThermo click here, the following was output:

Code: [Select]
r0=0
r1=1D7F

synced
1234DeviceOpen Success

Looks to be working from here.
Can you ensure all of your hardware connections are correct and there's no bad solder joints?

Best Regards,
CleOSupport
10
Software / i2c Bridging hanging arduino
« Last post by Chris on September 18, 2018, 12:55:11 PM »
Hello,

I'm trying to get the Ir Thermo click board to work on the CleO50 MikroBUS slot 1 but it keeps on hanging on:

 HandleI2C = CleO.DeviceOpen(1, BRIDGE_TYPE_I2CM, sizeof(i2c_open_opt), (uint8_t*)&i2c_open_opt);

from:

/*************************************************************************
  Librairies
*************************************************************************/
#include <SPI.h>
#include <CleO.h>
#include <Wire.h>

/*************************************************************************
  GLOBAL VARIABLES
*************************************************************************/
// Ir Thermo click constants
#define _IR_THERMO_ADDR  0x5A
#define _AMB_TEMP        0x06
#define _OBJ_TEMP        0x07

int16_t HandleI2C = -1;
int16_t BytesWritten;

/*************************************************************************
  APPLICATION SETUP
*************************************************************************/
void setup() {

  Serial.begin(9600);
 
  Wire.begin();
  CleO.begin();                                     // Initiate Cleo Screen
 
  Bridge::i2cm_options i2c_open_opt;
  Serial.print("1");
  i2c_open_opt.SlaveAddress = 0x5A;
  Serial.print("2");
  i2c_open_opt.ClockSpeed = 100000;
  Serial.print("3");
  HandleI2C = CleO.DeviceOpen(1, BRIDGE_TYPE_I2CM, sizeof(i2c_open_opt), (uint8_t*)&i2c_open_opt);
  Serial.print("4");
  if (HandleI2C < 0 )
  {
    /* Failed to open a handle */
    Serial.print("DeviceOpen failed");
  }
  else
  {
    Serial.print("DeviceOpen Success");
  }
}

Ive tried all the different supported clock speeds just to see if it makes a difference but it doesn't!

Please can i have some help with this!

Thanks,

Chris
Pages: [1] 2 3 ... 10