Go Down

Topic: how would i code this (Read 1 time) previous topic - next topic

JimboZA

Do you know the relationship well?

The look up matrix idea would require that you know the output value for pairs of inputs; alternatively if you know the output as a function of the inputs then that's a simple matter of coding something like on-time = (0.5 x pot-time) + (thermistor-value^1.3) + 24 or whatever.

On the other hand if the relationship is fuzzy, well fuzzy logic might be good and I see from this thread that there is an Arduino fuzzy logic library.
meArm build blog:     http://jimbozamearm.blogspot.com/

Please don't PM for technical advice. Firstly my advice is sometimes wrong, and second, in the forum you get a broader, more timely, range of responses.

jareeb

this is what i have so far. just coding for Serial feed back. it works good, now just need to get it to control and injector. but we can just use a led for testing right now.

Code: [Select]
int pot = A1; // pin for the potentiometer
int output = 10; // pin that the out put is on
int potval,tempval = 0; // variable for storing the valve from the potentiometer
int temp = A2; // pin for the 10k thermistor

void setup() {
  Serial.begin(9600);      // for debugging via the Serial Monitor
}

void loop() {
  potval = analogRead(pot);  // read the value from the sensor
  tempval = analogRead(temp);
 
  Serial.print("temp                 ");
  Serial.print("pot");
  Serial.println(potval);
  delay(500);
  Serial.println(tempval);
}

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy