Hi everybody,
I'm new in Arduino and I need some help please, since I work with biomedical instrumentation but I'm not an expert in computer programming! I have to read from 12 emg sensors with my Micro. I proceeded to change the ADC prescaler select bits to achieve the desired sampling frequency, and this seems to be working properly (total acquisition time about 400 microseconds). Now I have to send these values to my pc at the appropriate speed (acquisition + transmission <= 1 millisecond). I read on the ArduinoBoardMicro page
The 32U4 also allows for serial (CDC) communication over USB and appears as a virtual com port to software on the computer. The chip also acts as a full speed USB 2.0 device, using standard USB COM drivers.
and from what I understand with Serial. commands it uses the CDC protocol. The only way I have found is to send the array with the 12 values with Serial.write(buf, len), hence without ASCII conversion of Serial.print(). Furthermore with Serial.print() I can only send one at a time with a for cicle and it's too slow. This is the code:
[quote]
[color=#CC6600]int[/color] pin[] = {A0,A1,A2,A3,A4,A5,4,6,8,9,10,12};
[color=#CC6600]byte[/color] a[] = {0,0,0,0,0,0,0,0,0,0,0,0};
[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]() {
[color=#CC6600][b]Serial[/b][/color].[color=#CC6600]begin[/color](115200);
[color=#CC6600]while[/color] (![color=#CC6600][b]Serial[/b][/color]) {
; [color=#7E7E7E]// wait for a serial connection to be established[/color]
}
}
[color=#CC6600]void[/color] [color=#CC6600][b]loop[/b][/color]() {
[color=#CC6600]for[/color] ([color=#CC6600]byte[/color] i = 0; i < 12; i++)
{
a[i] = [color=#CC6600]byte[/color]([color=#CC6600]analogRead[/color](pin[i])/4);
}
[color=#CC6600][b]Serial[/b][/color].[color=#CC6600]write[/color](a, sizeof(a));
[color=#CC6600][b]Serial[/b][/color].[color=#CC6600]flush[/color]();
[color=#CC6600][b]Serial[/b][/color].[color=#CC6600]println[/color]([color=#006699]""[/color]);
}
[/quote]
Now how can I view and save the Micro sent values array? Otherwise, where can I find the
standard USB COM drivers
mentioned in the Main Site and how can I use them to improve transmission rate and than use the Serial.print(a*) command? There are other ways to increase the byte transfert rate? Thanks.*