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.


Topics - Chris

Pages: [1]
1
Software / CleO file write append to new line
« 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 / i2c Bridging hanging arduino
« 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]