Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / send ethernet data web server on: July 05, 2014, 02:27:31 pm
i make arduino ethernet for send sensor data to delphi
i use arduino web server for get data, when i access the web server the ethernet arduino can give data to the web server but i use my delphi for get sensor data to send via memo line it cant send

what i must to do for the next step? thx


here the delhp and arduino
http://www.mediafire.com/download/orhwno8vhk4ktib/POS.rar
2  Using Arduino / Programming Questions / Re: pointer and array on fuzzy on: November 29, 2013, 09:37:44 pm
Code:
#include "krpai.h"
float data1;
float data2;
float outs;
float _not(float x)
{
return (float)(1.0-x);
}
// Generates the values in the range [min,max] with increments
// defined by 'step'.
void generate(float minimum, float maximum, float st, float* values,int length)
{
float x = minimum;
int i;
for(i=0;i<length;i++,x+=st)
values[i] = x;
}
// Sets all elements in the array with the same value
void set(float* values,int length,float value)
{
int i;
for(i=0;i<length;i++)
values[i] = value;
}
// Returns the smallest element of an array
float min_array(float* x, int length)
{
    if(length <= 0) return (float)0;
float m = x[0];
int i=1;
for(;i<length;i++)
m = min(m,x[i]);
return m;
}
// Returns the largest element of an array
float max_array(float* x, int length)
{
    if(length <= 0) return (float)0;
float m = x[0];
int i=1;
for(;i<length;i++)
m = max(m,x[i]);
return m;
}
// Centroid of points
void centroid(float* x, float* y, int length, float* Cx, float* Cy)
{
float a = 0;
float tx = 0;
// float ty = 0;
float t = 0;
int i = 0;
        int l = length - 1;
for(;i<l;i++)
{
t = ((x[i] * y[i+1]) - (x[i+1] * y[i]));
                a += t/2;
tx = (x[i] + x[i+1]) * t;
// ty = (y[i] + y[i+1]) * t;
}
*Cx = (tx /(6 * a));
// *Cy = (ty /(6 * a));
}
// Triangular Member Function
float trimf(float x, float a, float b, float c)
{
    return (float)max(min((x - a) / (b - a), (c - x) / (c - b)), 0);
}
// Trapezoidal Member Function
float trapmf(float x, float a, float b, float c, float d)
{
    return (float)max(min((x - a) / (b - a), min(1.0, (d - x) / (d - c))), 0);
}
// Aggregation code for membership functions that require 3 setting values
void aggregate3(float* rules, int* ruleIndexes, int ruleIndexLength, float* xArr, float *yArr, int resultLength,_mffloat3 mf,float a,float b,float c)
{
int i=0, j=0;
for(;i<resultLength;i++)
{
for(j=0;j<ruleIndexLength;j++)
{yArr[i] = max(yArr[i],min(rules[ruleIndexes[j]],mf(xArr[i],a,b,c)));}
}
}

// Aggregation code for membership functions that require 4 setting values
void aggregate4(float* rules, int* ruleIndexes, int ruleIndexLength, float* xArr, float *yArr, int resultLength,_mffloat4 mf,float a,float b,float c,float d)
{
int i=0, j=0;
for(;i<resultLength;i++)
{
for(j=0;j<ruleIndexLength;j++)
{yArr[i] = max(yArr[i],min(rules[ruleIndexes[j]],mf(xArr[i],a,b,c,d)));}
}
}

void krpai(float* inputs, float* outputs)
{ // Transformation of inputs to fuzzy inputs.
// Input variable K1
float Inputs1[5];
// Input term 'D'for variable 'K1'
Inputs1[0] = trimf(inputs[0],2,6,10);
// Input term 'S'for variable 'K1'
Inputs1[1] = trimf(inputs[0],6,10,14);
// Input term 'J'for variable 'K1'
Inputs1[2] = trimf(inputs[0],10,14,18);
// Input term 'SD'for variable 'K1'
Inputs1[3] = trapmf(inputs[0],0,0,2,6);
// Input term 'SJ'for variable 'K1'
Inputs1[4] = trapmf(inputs[0],14,18,20,20);
// Input variable K2
float Inputs2[5];
// Input term 'D'for variable 'K2'
Inputs2[0] = trimf(inputs[1],2,6,10);
// Input term 'S'for variable 'K2'
Inputs2[1] = trimf(inputs[1],6,10,14);
// Input term 'J'for variable 'K2'
Inputs2[2] = trimf(inputs[1],10,14,18);
// Input term 'SD'for variable 'K2'
Inputs2[3] = trapmf(inputs[1],0,0,2,6);
// Input term 'SJ'for variable 'K2'
Inputs2[4] = trapmf(inputs[1],14,18,20,20);
// Build all the conditions.
// Variable to store the condition result
float R[25];
float CondR[2];
// Handle conditions for rule 1
CondR[0] = Inputs1[0];
CondR[1] = Inputs2[0];
R[0] = 1 * min_array(CondR,2);
// Handle conditions for rule 2
CondR[0] = Inputs1[0];
CondR[1] = Inputs2[1];
R[1] = 1 * min_array(CondR,2);
// Handle conditions for rule 3
CondR[0] = Inputs1[0];
CondR[1] = Inputs2[2];
R[2] = 1 * min_array(CondR,2);
// Handle conditions for rule 4
CondR[0] = Inputs1[0];
CondR[1] = Inputs2[3];
R[3] = 1 * min_array(CondR,2);
// Handle conditions for rule 5
CondR[0] = Inputs1[0];
CondR[1] = Inputs2[4];
R[4] = 1 * min_array(CondR,2);
// Handle conditions for rule 6
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[0];
R[5] = 1 * min_array(CondR,2);
// Handle conditions for rule 7
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[1];
R[6] = 1 * min_array(CondR,2);
// Handle conditions for rule 8
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[2];
R[7] = 1 * min_array(CondR,2);
// Handle conditions for rule 9
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[3];
R[8] = 1 * min_array(CondR,2);
// Handle conditions for rule 10
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[4];
R[9] = 1 * min_array(CondR,2);
// Handle conditions for rule 11
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[0];
R[10] = 1 * min_array(CondR,2);
// Handle conditions for rule 12
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[1];
R[11] = 1 * min_array(CondR,2);
// Handle conditions for rule 13
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[2];
R[12] = 1 * min_array(CondR,2);
// Handle conditions for rule 14
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[3];
R[13] = 1 * min_array(CondR,2);
// Handle conditions for rule 15
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[4];
R[14] = 1 * min_array(CondR,2);
// Handle conditions for rule 16
CondR[0] = Inputs1[3];
CondR[1] = Inputs2[0];
R[15] = 1 * min_array(CondR,2);
// Handle conditions for rule 17
CondR[0] = Inputs1[3];
CondR[1] = Inputs2[1];
R[16] = 1 * min_array(CondR,2);
// Handle conditions for rule 18
CondR[0] = Inputs1[3];
CondR[1] = Inputs2[2];
R[17] = 1 * min_array(CondR,2);
// Handle conditions for rule 19
CondR[0] = Inputs1[3];
CondR[1] = Inputs2[3];
R[18] = 1 * min_array(CondR,2);
// Handle conditions for rule 20
CondR[0] = Inputs1[3];
CondR[1] = Inputs2[4];
R[19] = 1 * min_array(CondR,2);
// Handle conditions for rule 21
CondR[0] = Inputs1[4];
CondR[1] = Inputs2[0];
R[20] = 1 * min_array(CondR,2);
// Handle conditions for rule 22
CondR[0] = Inputs1[4];
CondR[1] = Inputs2[1];
R[21] = 1 * min_array(CondR,2);
// Handle conditions for rule 23
CondR[0] = Inputs1[4];
CondR[1] = Inputs2[2];
R[22] = 1 * min_array(CondR,2);
// Handle conditions for rule 24
CondR[0] = Inputs1[4];
CondR[1] = Inputs2[3];
R[23] = 1 * min_array(CondR,2);
// Handle conditions for rule 25
CondR[0] = Inputs1[4];
CondR[1] = Inputs2[4];
R[24] = 1 * min_array(CondR,2);
// Basic output processing
int res = 100;
float step;
float xMin;
float xMax;
float x[res];
float y[res];
float t;
int value[25];
// Output variable VS
xMin = -30;
xMax = 30;
t=0;
step = (xMax - xMin) / (float)(res - 1);
generate(xMin, xMax, step, x, res);
set(y, res, 0);
value[0] = 5;
value[1] = 11;
aggregate3(R,value,2,x,y,res,trimf,-20,-10,0);
value[0] = 0;
value[1] = 3;
value[2] = 4;
value[3] = 8;
value[4] = 9;
value[5] = 12;
value[6] = 14;
value[7] = 15;
value[8] = 18;
value[9] = 19;
value[10] = 20;
value[11] = 23;
value[12] = 24;
aggregate4(R,value,13,x,y,res,trapmf,10,20,30,30);
value[0] = 1;
value[1] = 2;
value[2] = 7;
value[3] = 10;
value[4] = 13;
value[5] = 16;
value[6] = 17;
value[7] = 21;
value[8] = 22;
aggregate3(R,value,9,x,y,res,trimf,0,10,20);
value[0] = 6;
aggregate3(R,value,1,x,y,res,trimf,-10,0,10);
centroid(x, y, res, &outputs[0], &t);
       
}
void setup()
{
Serial.begin(9600);
}

void loop()
{
  data1=23.0;
  data2=10.0;
  outs=0.0;
  float inputs[] = {data1,data2};
  float outputs[] = {outs};
  krpai(inputs, outputs);
  Serial.println(outputs[0]); 
}

centroid(x, y, res, &outputs[0], &t); is it means when the program already processed centroid function it will store in array outputs and the adress is outputs0?
3  Using Arduino / Programming Questions / Re: pointer and array on fuzzy on: November 29, 2013, 12:33:16 pm
nice thx smiley-grin compile success  smiley-kitty thx sir
4  Using Arduino / Programming Questions / Re: pointer and array on fuzzy on: November 29, 2013, 12:23:23 pm
#include "kretek.h"
// Not Function
float inputs[] = {10.3,20.3,30.3};
float outputs[] = {10.3,23.3,38.3};

like this?

and in void loop
 kretek(1,1);-->go to array float adrees number 1?

correct?



5  Using Arduino / Programming Questions / Re: pointer and array on fuzzy on: November 29, 2013, 12:03:49 pm
so if float* i must fill in float or i fill int and it will be transform into float type?
so on the top
int inputs[] = {10,20,30};
int outputs[] = {10,20,30};

and in void loop
kretek(inputs[0],outputs[0]);
it means the array number of 0 is 10 and 1 is 20?
6  Using Arduino / Programming Questions / Re: pointer and array on fuzzy on: November 29, 2013, 11:32:29 am
interger like 10,20,30
float 10.33 20.33 30.56
is it correct?
7  Using Arduino / Programming Questions / Re: pointer and array on fuzzy on: November 29, 2013, 11:26:44 am
Code:
#include "kretek.h"
// Not Function
int inputs[2];
int outputs[2];
float _not(float x)
{
return (float)(1.0-x);
}
// Generates the values in the range [min,max] with increments
// defined by 'step'.
void generate(float minimum, float maximum, float st, float* values,int length)
{
float x = minimum;
int i;
for(i=0;i<length;i++,x+=st)
values[i] = x;
}
// Sets all elements in the array with the same value
void set(float* values,int length,float value)
{
int i;
for(i=0;i<length;i++)
values[i] = value;
}
// Returns the smallest element of an array
float min_array(float* x, int length)
{
    if(length <= 0) return (float)0;
float m = x[0];
int i=1;
for(;i<length;i++)
m = min(m,x[i]);
return m;
}
// Returns the largest element of an array
float max_array(float* x, int length)
{
    if(length <= 0) return (float)0;
float m = x[0];
int i=1;
for(;i<length;i++)
m = max(m,x[i]);
return m;
}
// Centroid of points
void centroid(float* x, float* y, int length, float* Cx, float* Cy)
{
float a = 0;
float tx = 0;
// float ty = 0;
float t = 0;
int i = 0;
        int l = length - 1;
for(;i<l;i++)
{
t = ((x[i] * y[i+1]) - (x[i+1] * y[i]));
                a += t/2;
tx = (x[i] + x[i+1]) * t;
// ty = (y[i] + y[i+1]) * t;
}
*Cx = (tx /(6 * a));
// *Cy = (ty /(6 * a));
}
// Triangular Member Function
float trimf(float x, float a, float b, float c)
{
    return (float)max(min((x - a) / (b - a), (c - x) / (c - b)), 0);
}
// Trapezoidal Member Function
float trapmf(float x, float a, float b, float c, float d)
{
    return (float)max(min((x - a) / (b - a), min(1.0, (d - x) / (d - c))), 0);
}
// Aggregation code for membership functions that require 3 setting values
void aggregate3(float* rules, int* ruleIndexes, int ruleIndexLength, float* xArr, float *yArr, int resultLength,_mffloat3 mf,float a,float b,float c)
{
int i=0, j=0;
for(;i<resultLength;i++)
{
for(j=0;j<ruleIndexLength;j++)
{yArr[i] = max(yArr[i],min(rules[ruleIndexes[j]],mf(xArr[i],a,b,c)));}
}
}

// Aggregation code for membership functions that require 4 setting values
void aggregate4(float* rules, int* ruleIndexes, int ruleIndexLength, float* xArr, float *yArr, int resultLength,_mffloat4 mf,float a,float b,float c,float d)
{
int i=0, j=0;
for(;i<resultLength;i++)
{
for(j=0;j<ruleIndexLength;j++)
{yArr[i] = max(yArr[i],min(rules[ruleIndexes[j]],mf(xArr[i],a,b,c,d)));}
}
}

void kretek(float* inputs, float* outputs)
{ // Transformation of inputs to fuzzy inputs.
// Input variable K1
float Inputs1[5];
// Input term 'D'for variable 'K1'
Inputs1[0] = trimf(inputs[0],2,6,10);
// Input term 'S'for variable 'K1'
Inputs1[1] = trimf(inputs[0],6,10,14);
// Input term 'J'for variable 'K1'
Inputs1[2] = trimf(inputs[0],10,14,18);
// Input term 'SD'for variable 'K1'
Inputs1[3] = trapmf(inputs[0],-0.0529,-0.0529,1.95,5.95);
// Input term 'SJ'for variable 'K1'
Inputs1[4] = trapmf(inputs[0],14.1,18.1,20.1,20.1);
// Input variable K2
float Inputs2[5];
// Input term 'D'for variable 'K2'
Inputs2[0] = trimf(inputs[1],2,6,10);
// Input term 'S'for variable 'K2'
Inputs2[1] = trimf(inputs[1],6,10,14);
// Input term 'J'for variable 'K2'
Inputs2[2] = trimf(inputs[1],10,14,18);
// Input term 'SD'for variable 'K2'
Inputs2[3] = trapmf(inputs[1],0,0,2,6);
// Input term 'SJ'for variable 'K2'
Inputs2[4] = trapmf(inputs[1],14,18,20,20);
// Build all the conditions.
// Variable to store the condition result
float R[12];
float CondR[2];
// Handle conditions for rule 1
CondR[0] = Inputs1[0];
CondR[1] = Inputs2[1];
R[0] = 1 * min_array(CondR,2);
// Handle conditions for rule 2
CondR[0] = Inputs1[0];
CondR[1] = Inputs2[2];
R[1] = 1 * min_array(CondR,2);
// Handle conditions for rule 3
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[0];
R[2] = 1 * min_array(CondR,2);
// Handle conditions for rule 4
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[1];
R[3] = 1 * min_array(CondR,2);
// Handle conditions for rule 5
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[2];
R[4] = 1 * min_array(CondR,2);
// Handle conditions for rule 6
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[0];
R[5] = 1 * min_array(CondR,2);
// Handle conditions for rule 7
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[1];
R[6] = 1 * min_array(CondR,2);
// Handle conditions for rule 8
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[3];
R[7] = 1 * min_array(CondR,2);
// Handle conditions for rule 9
CondR[0] = Inputs1[3];
CondR[1] = Inputs2[1];
R[8] = 1 * min_array(CondR,2);
// Handle conditions for rule 10
CondR[0] = Inputs1[3];
CondR[1] = Inputs2[2];
R[9] = 1 * min_array(CondR,2);
// Handle conditions for rule 11
CondR[0] = Inputs1[4];
CondR[1] = Inputs2[1];
R[10] = 1 * min_array(CondR,2);
// Handle conditions for rule 12
CondR[0] = Inputs1[4];
CondR[1] = Inputs2[2];
R[11] = 1 * min_array(CondR,2);
// Basic output processing
int res = 100;
float step;
float xMin;
float xMax;
float x[res];
float y[res];
float t;
int value[12];
// Output variable VS
xMin = -50;
xMax = 50;
t=0;
step = (xMax - xMin) / (float)(res - 1);
generate(xMin, xMax, step, x, res);
set(y, res, 0);
value[0] = 2;
value[1] = 6;
aggregate3(R,value,2,x,y,res,trimf,-33.33,-16.67,0);
value[0] = 0;
value[1] = 1;
value[2] = 4;
value[3] = 5;
value[4] = 7;
value[5] = 8;
value[6] = 9;
value[7] = 10;
value[8] = 11;
aggregate3(R,value,9,x,y,res,trimf,0,16.67,33.33);
value[0] = 3;
aggregate3(R,value,1,x,y,res,trimf,-16.67,0,16.67);
centroid(x, y, res, &outputs[0], &t);
}
void setup()
{
}

void loop()
{
  kretek(inputs[0],outputs[0]);
}

i already have changed my code but still error
Arduino: 1.5.4 (Windows 7), Board: "Arduino Due (Programming Port)"

sketch_nov27b.ino: In function 'void loop()':
sketch_nov27b:213: error: invalid conversion from 'int' to 'float*'
sketch_nov27b:213: error: initializing argument 1 of 'void kretek(float*, float*)'
sketch_nov27b:213: error: invalid conversion from 'int' to 'float*'
sketch_nov27b:213: error: initializing argument 2 of 'void kretek(float*, float*)'

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
8  Using Arduino / Programming Questions / Re: pointer and array on fuzzy on: November 29, 2013, 11:15:49 am
maybe like this the code?
inputs[]?
its my first programming using array
so i must declare
int inputs[]?
9  Using Arduino / Programming Questions / Re: pointer and array on fuzzy on: November 28, 2013, 07:06:09 pm
so i must fill
inputs[1]=20.4;
kretek(inputs[1],outputs[1]);

like this?
10  Using Arduino / Programming Questions / Re: pointer and array on fuzzy on: November 28, 2013, 11:27:57 am
4. Two output files will be produced, a .h file and a C file.  Copy the contents of the C file and dump it into your Arduino IDE.  Put the .h file in the same folder as your Arduino sketch.

5. To access the system, create an array of inputs and an array of outputs.

6. Call the system function with a pointer to the inputs and a pointer to the outputs.  (the function will have the same name as your .FIS file).

6. Use the outputs of the FIS to control whatever it is you need to control.

i already have build the array and i used to arduino but error

when i use in void loop
kretek(20.1,20.1);

error again so what i should do?
11  Using Arduino / Programming Questions / Re: pointer and array on fuzzy on: November 28, 2013, 10:51:19 am
the kretek.h got from the ekstrator from that web (matlab to arduino code)

i cant understand what you mean return float?
can you explain to me some example of float return?
12  Using Arduino / Programming Questions / pointer and array on fuzzy on: November 28, 2013, 09:55:50 am
i use the matlab to fuzzy from this web:
http://www.makeproto.com/projects/fuzzy/matlab_arduino_FIST/index.php

and i got the code

Code:
#include "kretek.h"
// Not Function
int inputs[] = {1,2,3,4,5,6,7,8,9,10};
int outputs[] = {1,2,3,4,5,6,7,8,9,10};
float _not(float x)
{
return (float)(1.0-x);
}
// Generates the values in the range [min,max] with increments
// defined by 'step'.
void generate(float minimum, float maximum, float st, float* values,int length)
{
float x = minimum;
int i;
for(i=0;i<length;i++,x+=st)
values[i] = x;
}
// Sets all elements in the array with the same value
void set(float* values,int length,float value)
{
int i;
for(i=0;i<length;i++)
values[i] = value;
}
// Returns the smallest element of an array
float min_array(float* x, int length)
{
    if(length <= 0) return (float)0;
float m = x[0];
int i=1;
for(;i<length;i++)
m = min(m,x[i]);
return m;
}
// Returns the largest element of an array
float max_array(float* x, int length)
{
    if(length <= 0) return (float)0;
float m = x[0];
int i=1;
for(;i<length;i++)
m = max(m,x[i]);
return m;
}
// Centroid of points
void centroid(float* x, float* y, int length, float* Cx, float* Cy)
{
float a = 0;
float tx = 0;
// float ty = 0;
float t = 0;
int i = 0;
        int l = length - 1;
for(;i<l;i++)
{
t = ((x[i] * y[i+1]) - (x[i+1] * y[i]));
                a += t/2;
tx = (x[i] + x[i+1]) * t;
// ty = (y[i] + y[i+1]) * t;
}
*Cx = (tx /(6 * a));
// *Cy = (ty /(6 * a));
}
// Triangular Member Function
float trimf(float x, float a, float b, float c)
{
    return (float)max(min((x - a) / (b - a), (c - x) / (c - b)), 0);
}
// Trapezoidal Member Function
float trapmf(float x, float a, float b, float c, float d)
{
    return (float)max(min((x - a) / (b - a), min(1.0, (d - x) / (d - c))), 0);
}
// Aggregation code for membership functions that require 3 setting values
void aggregate3(float* rules, int* ruleIndexes, int ruleIndexLength, float* xArr, float *yArr, int resultLength,_mffloat3 mf,float a,float b,float c)
{
int i=0, j=0;
for(;i<resultLength;i++)
{
for(j=0;j<ruleIndexLength;j++)
{yArr[i] = max(yArr[i],min(rules[ruleIndexes[j]],mf(xArr[i],a,b,c)));}
}
}

// Aggregation code for membership functions that require 4 setting values
void aggregate4(float* rules, int* ruleIndexes, int ruleIndexLength, float* xArr, float *yArr, int resultLength,_mffloat4 mf,float a,float b,float c,float d)
{
int i=0, j=0;
for(;i<resultLength;i++)
{
for(j=0;j<ruleIndexLength;j++)
{yArr[i] = max(yArr[i],min(rules[ruleIndexes[j]],mf(xArr[i],a,b,c,d)));}
}
}

void kretek(float* inputs, float* outputs)
{ // Transformation of inputs to fuzzy inputs.
// Input variable K1
float Inputs1[5];
// Input term 'D'for variable 'K1'
Inputs1[0] = trimf(inputs[0],2,6,10);
// Input term 'S'for variable 'K1'
Inputs1[1] = trimf(inputs[0],6,10,14);
// Input term 'J'for variable 'K1'
Inputs1[2] = trimf(inputs[0],10,14,18);
// Input term 'SD'for variable 'K1'
Inputs1[3] = trapmf(inputs[0],-0.0529,-0.0529,1.95,5.95);
// Input term 'SJ'for variable 'K1'
Inputs1[4] = trapmf(inputs[0],14.1,18.1,20.1,20.1);
// Input variable K2
float Inputs2[5];
// Input term 'D'for variable 'K2'
Inputs2[0] = trimf(inputs[1],2,6,10);
// Input term 'S'for variable 'K2'
Inputs2[1] = trimf(inputs[1],6,10,14);
// Input term 'J'for variable 'K2'
Inputs2[2] = trimf(inputs[1],10,14,18);
// Input term 'SD'for variable 'K2'
Inputs2[3] = trapmf(inputs[1],0,0,2,6);
// Input term 'SJ'for variable 'K2'
Inputs2[4] = trapmf(inputs[1],14,18,20,20);
// Build all the conditions.
// Variable to store the condition result
float R[12];
float CondR[2];
// Handle conditions for rule 1
CondR[0] = Inputs1[0];
CondR[1] = Inputs2[1];
R[0] = 1 * min_array(CondR,2);
// Handle conditions for rule 2
CondR[0] = Inputs1[0];
CondR[1] = Inputs2[2];
R[1] = 1 * min_array(CondR,2);
// Handle conditions for rule 3
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[0];
R[2] = 1 * min_array(CondR,2);
// Handle conditions for rule 4
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[1];
R[3] = 1 * min_array(CondR,2);
// Handle conditions for rule 5
CondR[0] = Inputs1[1];
CondR[1] = Inputs2[2];
R[4] = 1 * min_array(CondR,2);
// Handle conditions for rule 6
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[0];
R[5] = 1 * min_array(CondR,2);
// Handle conditions for rule 7
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[1];
R[6] = 1 * min_array(CondR,2);
// Handle conditions for rule 8
CondR[0] = Inputs1[2];
CondR[1] = Inputs2[3];
R[7] = 1 * min_array(CondR,2);
// Handle conditions for rule 9
CondR[0] = Inputs1[3];
CondR[1] = Inputs2[1];
R[8] = 1 * min_array(CondR,2);
// Handle conditions for rule 10
CondR[0] = Inputs1[3];
CondR[1] = Inputs2[2];
R[9] = 1 * min_array(CondR,2);
// Handle conditions for rule 11
CondR[0] = Inputs1[4];
CondR[1] = Inputs2[1];
R[10] = 1 * min_array(CondR,2);
// Handle conditions for rule 12
CondR[0] = Inputs1[4];
CondR[1] = Inputs2[2];
R[11] = 1 * min_array(CondR,2);
// Basic output processing
int res = 100;
float step;
float xMin;
float xMax;
float x[res];
float y[res];
float t;
int value[12];
// Output variable VS
xMin = -50;
xMax = 50;
t=0;
step = (xMax - xMin) / (float)(res - 1);
generate(xMin, xMax, step, x, res);
set(y, res, 0);
value[0] = 2;
value[1] = 6;
aggregate3(R,value,2,x,y,res,trimf,-33.33,-16.67,0);
value[0] = 0;
value[1] = 1;
value[2] = 4;
value[3] = 5;
value[4] = 7;
value[5] = 8;
value[6] = 9;
value[7] = 10;
value[8] = 11;
aggregate3(R,value,9,x,y,res,trimf,0,16.67,33.33);
value[0] = 3;
aggregate3(R,value,1,x,y,res,trimf,-16.67,0,16.67);
centroid(x, y, res, &outputs[0], &t);
}
void setup()
{
}

void loop()
{
  inputs[1]=20.1;
  kretek(inputs[1],outputs[1]);
}

Arduino: 1.5.4 (Windows 7), Board: "Arduino Due (Programming Port)"

sketch_nov27b.ino: In function 'void loop()':
sketch_nov27b:214: error: invalid conversion from 'int' to 'float*'
sketch_nov27b:214: error: initializing argument 1 of 'void kretek(float*, float*)'
sketch_nov27b:214: error: invalid conversion from 'int' to 'float*'
sketch_nov27b:214: error: initializing argument 2 of 'void kretek(float*, float*)'
sketch_nov27b.ino: In function 'void loop()':
sketch_nov27b:214: error: invalid conversion from 'int' to 'float*'
sketch_nov27b:214: error: initializing argument 1 of 'void kretek(float*, float*)'
sketch_nov27b:214: error: invalid conversion from 'int' to 'float*'
sketch_nov27b:214: error: initializing argument 2 of 'void kretek(float*, float*)'

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
and got the error

im confuse how to use pointer and pointer in array
 smiley-eek-blue
13  Development / Other Software Development / Re: eFLL (Embedded Fuzzy Logic Library) - Fuzzy Logic on Arduino on: November 05, 2013, 09:43:13 am
nice alegz smiley your suggest very useful thx :)v
14  Development / Other Software Development / Re: eFLL (Embedded Fuzzy Logic Library) - Fuzzy Logic on Arduino on: October 28, 2013, 09:04:21 am
i mean when i want to use it my arduino doesnt detect the library (no in display example)
sory for bad english
15  Development / Other Software Development / Re: eFLL (Embedded Fuzzy Logic Library) - Fuzzy Logic on Arduino on: October 27, 2013, 09:05:33 am
this library doesnt work on my arduino 105 and 152
Pages: [1] 2