You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
676 B

const int input[] = {36, 39, 34 ,35 ,32 ,33 ,25 ,26};
long inputValue[] = {0, 0, 0, 0, 0, 0, 0, 0};
const int numPins = sizeof(input) / sizeof(input[0]);
#define RXD2 (16)
#define TXD2 (17)
void setup() {
//Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
analogReadResolution(12);
analogSetAttenuation(ADC_11db);
}
void values2uart() {
for (int i = 0; i < numPins; i++) {
Serial2.print(input[i]);
Serial2.print("-");
Serial2.print(inputValue[i]);
Serial2.print("\n");
}
}
void loop() {
for (int i = 0; i < numPins; i++) {
inputValue[i] = map(analogRead(input[i]), 0, 4096, 0, 25);
}
values2uart();
delay(50);
}