Source Code
Complete Arduino source code for the FTDX-10 controller project.
Source Code Documentation
Complete Arduino source code for the FTDX-10 controller project.
The code is organized into modular components for easy understanding and modification:
ArduinoFTDX10.ino (7.4KB)
Main controller program containing:
FTDX10_CAT.h/.cpp (7.9KB)
Complete CAT command library:
NextionDisplay.h/.cpp (8.2KB)
Nextion display control:
| File | Size | Lines | Description | Action |
|---|---|---|---|---|
ArduinoFTDX10.ino |
7.4KB | ~300 | Main controller program | View |
FTDX10_CAT.h |
2.7KB | ~80 | CAT library header | View |
FTDX10_CAT.cpp |
5.2KB | ~220 | CAT library implementation | View |
NextionDisplay.h |
2.3KB | ~70 | Display library header | View |
NextionDisplay.cpp |
5.9KB | ~230 | Display library implementation | View |
Organized into separate libraries for radio control and display interface
Comprehensive comments explain functionality and usage
Clean API makes adding new features straightforward
Built-in serial debugging for troubleshooting
Optimized for Arduino Mega with minimal memory usage
Code has been tested and verified to work
// Frequency control
void setFrequency(unsigned long freq);
void getFrequency();
unsigned long getCurrentFrequency();
// Mode control
void setMode(int mode, int bandwidth = 0);
void nextMode();
// VFO control
void selectVFO(char vfo);
void swapVFO();
// Power control
void setPower(int watts);
void setTX(bool tx);
// Audio/RF
void setAFGain(int gain);
void setRFGain(int gain);
// Meters
void getSMeter();
void getPOMeter();
// Event handling
void processEvents();
bool hasEvent();
NextionEvent getEvent();
// Display updates
void setFrequency(String freq);
void setMode(String mode);
void setPower(int watts);
void setSMeter(int value);
void setTXIndicator(bool tx);
// Component control
void setText(const char* component, String text);
void setValue(const char* component, int value);
void setPage(int pageNum);
| Serial Port | Pins | Baud Rate | Purpose |
|---|---|---|---|
Serial |
USB | 115200 | Debug output to PC |
Serial1 |
TX1 (18), RX1 (19) | 38400 | Radio CAT control |
Serial2 |
TX2 (16), RX2 (17) | 9600 | Nextion display |
#define MODE_LSB 1
#define MODE_USB 2
#define MODE_CW 3
#define MODE_FM 4
#define MODE_AM 5
#define MODE_RTTY_LSB 6
#define MODE_CW_R 7
#define MODE_DATA_LSB 8
#define MODE_RTTY_USB 9
#define MODE_DATA_FM 10
#define MODE_FM_N 11
#define MODE_DATA_USB 12
#define MODE_AM_N 13
#define MODE_C4FM 14
#define NEX_EVENT_RELEASE 0x00
#define NEX_EVENT_PRESS 0x01
const unsigned long updateInterval = 100; // Display update: 100ms
const unsigned long freqUpdateInterval = 500; // Radio poll: 500ms
ArduinoFTDX10.ino in Arduino IDEAll code is self-contained. No need to install additional Arduino libraries!