So I've got three boards that I'm using to test this (modified) code:
int sensor1Pin = A0;
int sensor2Pin = A1;
int sensor3Pin = A2;
float sensors[] = {0,0,0};
void setup(){
Serial.begin(9600);
}
void loop(){
sensors[0] = analogRead(sensor1Pin);
sensors[1] = analogRead(sensor2Pin);
sensors[2] = analogRead(sensor3Pin);
Serial.print(sensors[0]);
Serial.print(",");
Serial.print(sensors[1]);
Serial.print(",");
Serial.println(sensors[1]);
}
An Uno, a Feather M0, and an MKR1000. The code will only work on the Uno because it's AVR-based whereas the other two boards are SAMD. When running on a feather, you get this error:
/home/ghylama/Arduino/libraries/SoftwareSerial_master/SoftwareSerial.cpp:260:2: error: #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors
#error This version of SoftwareSerial supports only 20, 16 and 8MHz processors
However, the resolution of the Uno is too low for my purposes (its DAC has a resolution of 10, whereas I need a resolution of 12, minimum). Are there any libraries/workarounds that I can use for this purpose?
I've tried SoftwareSerial, NeoSWSerial, and this one.
analogRead
here though, which uses the ADC.