Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: multi input - single output %correlated on: February 03, 2013, 07:11:00 pm
PaulS

the total do not need to be 100% beacause the maximum is 100% already!
some factor may induce a 100% of total example
i am cruising speed at 100km/h
so i have a 5% load with throttle maybe 15% on the trimm potentiometer
the rest still at zero
then im am flooring it ( tps ramp up with a filling 25% plus the accelerometer 45% boost comming un to the 15%
the rest still at zero even with all other factor comming up i dont care i need it to be at 100% at this moment
and for the digital input read i need to be minus %ages 

retrolefty

that is a pretty good solution for my problem
i need something like that beacause the trimm potentiometer sould be a master solded at 100%
and coul be considered as a master trimm and all the other input could be aswell considered as secondary input
!!!!! i very interested by your solution

PeterH

as i need to consider all input '' not equal to 100% '' could this solution can be used ???
beacause if i do an average i could not assign a +value to each input more than the average total ....
it could be a problem .....!!
2  Using Arduino / Programming Questions / multi input - single output %correlated on: February 03, 2013, 02:31:10 pm
hi everybody!
i am experimenting a dificulty trying do something that i can't find any solution

i am trying to get a pwm output vary from a multiple of input but not only with fixed percentage
value from each other, example :

analogue input 1 : input 0 -5v  but count for 10% of total output
analogue input 2 : input 0- 5v  but count for 25% of total output
analogue input 3 : input 0 -5v  but count for 45% of total output
analogue input 4 : input 0 -5v  but count for 55% of total output
analogue input 5 : input 0 -5v  but count for 35% of total output
analogue input 6 : input 0 -5v  but count for 20% of total output
digital input read : input i-o    but count for -45% of total output
digital input read : input i-o    but count for -25% of total output

and most dificult to do for me its when another digital input read is activated
by a momentary shitch the mapping is only depended a 100% from 1 analogue input
and if you clic again its returning to the multi input mapping

i have already try a solution but i am pretty sure i am in the wrong way !!

Code:
const int analogInPin0 = A0;  
const int analogInPin1 = A1;
const int analogOutPin = 9;
const int automanu = A3;
const int hbk = 2;

int sensorValue0 = 0;        
int sensorValue1 = 0;
int outputValue0 = 0;      
int outputValue1 = 0;
int outputValue2 = 0;
int sensorValue2 = 0;


void setup() {
  
  Serial.begin(9600);
}

void loop() {
  
  sensorValue0 = analogRead(analogInPin0);
  sensorValue1 = analogRead(analogInPin1);
  sensorValue2 = analogRead(automanu);
  
  outputValue0 = map(sensorValue0, 0, 1800, 0, 255);  
  outputValue1 = map(sensorValue1, 0%1, 2046%50, 0%1, 255%50);
  outputValue2 = map(sensorValue2, 0, 2046, 0, 255);
  
  analogWrite(analogOutPin, outputValue0 + outputValue1);
  
 if (sensorValue2 > 1)
  analogWrite(analogOutPin, 0);
  

  
  Serial.print("sensor = " );                      
  Serial.print(sensorValue0 + sensorValue1);
  Serial.print("\t output = ");      
  Serial.println(outputValue0 + outputValue1 - outputValue2);  
  Serial.print("automanu = " );
  Serial.print(sensorValue2);

  
  delay(50);                    
}

i am gonna put you in situation
this is for a transmition controller for a car !!
i need several input like : throttle position , boost pressure , potentiometer input, 2 axis accelerometer, hand brake,
foot brake, switch to activate or deactivate.
the output is controlling a 70amp mosfet to put powerr into the transmition for 4wd control
i have already tested the board and this simple programation its working fine but i think i am gone in the wrong way of programing the good way

if you can suggest me a way of programing this i will be very happy
thank you








Pages: [1]