Here is my code:
const int analogInPin1 = A0;
const int analogInPin2 = A1;
const int analogInPin3 = A2;
const int analogOutPin = 9;
int g = 0;
int m = 0;
int l = 0;
int G = 0;
int M = 0;
int L = 0;
int array[7]={'*',G ,':', M ,':', L,';' };
void setup() {
Serial.begin(115200);
}
void loop() {
g = analogRead(analogInPin1);
G = map(g, 0, 1023, 0, 5);
analogWrite(analogOutPin, G);
// print the results to the serial monitor:
//wSerial.print("gin = " );
//w Serial.print(g);
//w Serial.print("\t gout = ");
//w Serial.println(G);
m = analogRead(analogInPin2);
// map it to the range of the analog out:
M = map(m, 0, 1023, 0, 5);
// change the analog out value:
analogWrite(analogOutPin, M);
l = analogRead(analogInPin3);
// map it to the range of the analog out:
L = map(l, 0, 1023, 0, 5);
// change the analog out value:
analogWrite(analogOutPin, L);
array[1]=G;
array[3]=M;
array[5]=L;
// int array[]={G,M,L};
for (int i=0;i<7;i++)
{
Serial.print(array[i]);
Serial.print('\t');
if(i==6)
Serial.println();
// Serial.println(array[3]);
// Serial.println(array[5]);
}
// print the results to the serial monitor:
//w Serial.print("lin = " );
//w Serial.print(l);
//w Serial.print("\t lout = ");
//w Serial.println(L);
delay(2000);
}