Pages: 1 [2]   Go Down
Author Topic: how would i code this  (Read 1080 times)
0 Members and 1 Guest are viewing this topic.
Johannesburg. UTC+2
Online Online
Faraday Member
Karma: 108
Posts: 4723
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

The Elders of the Internet know who I am
I'm on LinkedIn:

Offline Offline
Karma: 0
Posts: 43
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

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                 ");

Pages: 1 [2]   Go Up
Jump to: