Demonstrates:
- Initializing IoControl
- Controlling digital and analog IO
- Handling IO-related events
#include <chrono>
#include <thread>
#include <spdlog/spdlog.h>
int main()
{
spdlog::set_level(spdlog::level::info);
spdlog::flush_on(spdlog::level::trace);
spdlog::error("Doly service stop failed");
return -1;
}
spdlog::info("Before testing, connect IO port 0 and port 1 (pin_0 <-> pin_1).");
uint8_t io_0 = 0;
uint8_t io_1 = 1;
spdlog::info("Read Pin:{} State:{}", io_1, static_cast<uint8_t>(state));
spdlog::info("Read Pin:{} State:{}", io_1, static_cast<uint8_t>(state));
return 0;
}
Shared helper utilities and common types used across the Doly SDK.
Public API for Doly IO control (IO Port GPIO pin read/write).
GpioState
Represents the digital logic level of a GPIO pin.
Definition GpioPin.h:47
@ LOW
Definition GpioPin.h:49
@ HIGH
Definition GpioPin.h:52
int8_t stopDolyService()
Stop the background Doly service (if running).
int8_t writePin(uint16_t id, uint8_t io_pin, GpioState state)
Write a GPIO state to an IO port pin.
float getVersion()
Get current library version.
GpioState readPin(uint16_t id, uint8_t io_pin)
Read the current GPIO state of an IO port pin.