參考資訊:
http://www.gammon.com.au/forum/?id=12779
https://www.arduino.cn/thread-12569-1-1.html
unsigned short buf[16] = { 0 }; int cc = 0; int adc[16] = { A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15 }; void setup() { Serial.begin(460800); ADCSRA |= (1 << ADPS2); ADCSRA &= ~(1 << ADPS1); ADCSRA &= ~(1 << ADPS0); Serial.flush(); } void loop() { for (cc = 0; cc < 16; cc++) { buf[cc] = analogRead(adc[cc]); } Serial.write((unsigned char*)buf, 16); }
P.S. 預設Sample Rate最高只有9600Hz,ADC Prescaler改為16後,Sample Rate可以達到76.8KHz