int analogPin1 = A0;
int analogPin2 = A1;
int analogPin3 = A2;
int val = 0;
int hal = 0;
int pal = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(analogPin1);
hal = analogRead(analogPin2);
pal = analogRead(analogPin3);
Serial.print(pal,val,hal); }
this is just some code i got from an tutorial that I modified for multiple inputs it worked just did not display all three inputs separately then i looked around and found that you can use multiple int in a display from this post Display multiple analog inputs over USB - #6 by system but this did not work for some reason
i had originally tried this but it would give an output like this
1
5
6
6
5
and all the input were combined into one string
where i was looking for this
1 5 6
o 5 6
1 4 8
Read the forum guidelines to see how to properly post code and some hints on how to get the most from this forum. Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
This example will write a string with comma separated values (CSV). I introduced a delay so that the serial port is not flooded.
Note that the code is posted in code tags and formatted with the IDE autoformat tool.
int analogPin1 = A0;
int analogPin2 = A1;
int analogPin3 = A2;
int val = 0;
int hal = 0;
int pal = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
static unsigned long timer = 0;
unsigned long interval = 100;
if (millis() - timer >= interval)
{
timer = millis();
val = analogRead(analogPin1);
hal = analogRead(analogPin2);
pal = analogRead(analogPin3);
Serial.print(pal);
Serial.print(',');
Serial.print(val);
Serial.print(',');
Serial.println(hal);
}
}
i had code that already did that and did not work for the output i wanted
int analogPin1 = A0;
int analogPin2 = A1;
int analogPin3 = A2;
int val = 0;
int hal = 0;
int pal = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(analogPin1);
Serial.println(val);
hal = analogRead(analogPin2);
Serial.println(hal);
pal = analogRead(analogPin3);
Serial.println(pal); }
the reading of the other numbers acts as the delay I'm trying to display the three outputs in three different strings
int analogPin1 = A0;
int analogPin2 = A1;
int analogPin3 = A2;
int val = 0;
int hal = 0;
int pal = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(analogPin1);
Serial.println(val);
hal = analogRead(analogPin2);
Serial.println(hal);
pal = analogRead(analogPin3);
Serial.println(pal); }