I am wanting to use the 4.1 as an interface for both audio (in and out) and serial UART data (in and out).
The device shows up on Windows as Com5
Which RX / TX pair do I use on the 4.1 for hardware UART interface?
Where in the code is the Com Port assignment made or is that determined by the Arduino IDE?
If I want to have the code receive and respond to the USB Com Port (over Com 5 as assigned) and also relay data to another hardware port (RX/TX) on the 4.1, how is that done?
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <SPIFlash.h>
// Globals
char RxData[20];
int rxptr = 0;
AudioInputUSB usb1;
AudioInputI2S i2s2_1;
AudioOutputUSB usb2;
AudioOutputI2S i2s1;
AudioConnection patchCord1(usb1, 0, i2s1, 0);
AudioConnection patchCord2(usb1, 1, i2s1, 1);
AudioConnection patchCord3(i2s2_1, 0, usb2, 0);
AudioConnection patchCord4(i2s2_1, 1, usb2, 1);
AudioControlSGTL5000 sgtl5000_1;
void setup()
{
AudioMemory(10);
sgtl5000_1.enable();
sgtl5000_1.volume(0.8f);
Serial.begin(115200);
while (!Serial) {};
}
void loop()
{
char receivedChar;
if (Serial.available() > 0)
{
receivedChar = Serial.read();
if (receivedChar == 0x0D)
RxData[rxptr++] = receivedChar;
else
{
DecodeCmd();
rxptr = 0;
}
}
}
void DecodeCmd()
{
Serial.print(">> ");
}
The device shows up on Windows as Com5
Which RX / TX pair do I use on the 4.1 for hardware UART interface?
Where in the code is the Com Port assignment made or is that determined by the Arduino IDE?
If I want to have the code receive and respond to the USB Com Port (over Com 5 as assigned) and also relay data to another hardware port (RX/TX) on the 4.1, how is that done?
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <SPIFlash.h>
// Globals
char RxData[20];
int rxptr = 0;
AudioInputUSB usb1;
AudioInputI2S i2s2_1;
AudioOutputUSB usb2;
AudioOutputI2S i2s1;
AudioConnection patchCord1(usb1, 0, i2s1, 0);
AudioConnection patchCord2(usb1, 1, i2s1, 1);
AudioConnection patchCord3(i2s2_1, 0, usb2, 0);
AudioConnection patchCord4(i2s2_1, 1, usb2, 1);
AudioControlSGTL5000 sgtl5000_1;
void setup()
{
AudioMemory(10);
sgtl5000_1.enable();
sgtl5000_1.volume(0.8f);
Serial.begin(115200);
while (!Serial) {};
}
void loop()
{
char receivedChar;
if (Serial.available() > 0)
{
receivedChar = Serial.read();
if (receivedChar == 0x0D)
RxData[rxptr++] = receivedChar;
else
{
DecodeCmd();
rxptr = 0;
}
}
}
void DecodeCmd()
{
Serial.print(">> ");
}
Last edited: