To run the application directly:
cd "/Users/tim/VSCode/FAC1 - macOS Controller"
swift run FAC1-ControllerFor better performance, build in release mode:
cd "/Users/tim/VSCode/FAC1 - macOS Controller"
swift build -c release
# Run the release build
.build/release/FAC1-ControllerTo create a proper macOS .app bundle, you can use Xcode:
- Generate an Xcode project:
swift package generate-xcodeproj- Open the generated
FAC1-Controller.xcodeprojin Xcode - Select the target and build (⌘B)
- Archive the app (Product → Archive)
-
Connect Servos:
- Pan servo: Connect to servo controller with ID 1
- Tilt servo: Connect to servo controller with ID 2
- Provide appropriate power supply (typically 6-12V depending on servo model)
-
Connect USB-Serial Adapter:
- Connect TX/RX lines to servo data line
- Connect ground
- Plug USB into your Mac
-
Verify Connection:
- Check available ports:
ls /dev/cu.* - You should see something like
/dev/cu.usbserial-*or/dev/cu.usbmodem*
- Check available ports:
- Start the application
- The app will automatically search for USB-serial devices
- If connected successfully, the status will show "Connected to /dev/cu.xxxxx"
- Use the arrow buttons to control the servos
Edit ServoController.swift to adjust:
- Movement step size (line ~23): Change
positionStepvalue - Speed (line ~26): Change
movingSpeedvalue - Acceleration (line ~27): Change
movingAccvalue - Position limits (lines ~24-25): Change
minPositionandmaxPosition
After making changes, rebuild:
swift buildWhile the app doesn't have built-in keyboard shortcuts, you can:
- Tab through buttons
- Press Space to activate the focused button
- Use the checkbox and text fields normally
Check for USB devices:
ls /dev/cu.usb*Test servo connectivity with the SDK ping example:
# Clone the SDK separately to test
git clone https://github.com/FyrbyAdditive/feetech-servo-sdk-swift.git
cd feetech-servo-sdk-swift
swift run PingExampleView application logs:
# Run with output visible
swift run FAC1-Controller 2>&1 | tee app.log