| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A powerful and versatile solution for adding GPIO to a PC by controlling microcontroller-based hardware controllers like Arduino AVR, ESP32, STM32, and Teensy via serial communication.
PCGPIO simplifies interaction with your hardware, offering a robust and intuitive interface for hobbyists and professionals alike. Whether you're building a custom project or developing industrial automation solutions, PCGPIO empowers you to:
Built with asynchronous operations, PCGPIO ensures your applications remain responsive and efficient. It also features auto-detection of serial ports, robust error handling, and advanced configuration options for power users.
We welcome contributions! Please submit issues and pull requests to help improve PCGPIO.
This project is licensed under the GNU General Public License version 3 (GPLv3). See the LICENSE file for details.
This section covers all public methods in the PCGPIO library, grouped by functionality. Each method includes its signature, description, parameters, return type, and possible exceptions.
Initializes a new instance of the PCGPIO class.
Parameters:
Returns: None (constructor)
Exceptions: None
Establishes a serial connection to the controller.
Parameters:
Returns: Task
Exceptions:
Closes the serial connection.
Parameters: None
Returns: None
Exceptions: None
Resets the controller via a software or hardware command.
Parameters: None
Returns: Task
Exceptions:
Reads the state of a digital pin.
Parameters:
Returns: bool (true = HIGH, false = LOW)
Exceptions:
Writes a value to a digital pin.
Parameters:
Returns: Task
Exceptions:
Sets the mode of a pin (e.g., Input, Output).
Parameters:
Returns: Task
Exceptions:
Reads the value of an analog pin.
Parameters:
Returns: int (typically 0-1023)
Exceptions:
Sets the PWM duty cycle on a pin.
Parameters:
Returns: Task
Exceptions:
Attaches an interrupt handler to a pin.
Parameters:
Returns: Task
Exceptions:
Detaches an interrupt from a pin.
Parameters:
Returns: Task
Exceptions:
Starts a timer with microsecond precision.
Parameters:
Returns: Task
Exceptions:
Stops a running timer.
Parameters:
Returns: Task
Exceptions:
Reads the states of multiple digital pins in one command.
Parameters:
Returns: bool[] (array of pin states)
Exceptions:
Writes values to multiple digital pins in one command.
Parameters:
Returns: Task
Exceptions:
Sends a raw command to the controller and returns its response.
Parameters:
Returns: string (controller’s response)
Exceptions:
Configures serial communication settings.
Parameters:
Returns: Task
Exceptions:
Controls a stepper motor connected to the controller.
Parameters:
Returns: Task
Exceptions:
Sets the speed of a stepper motor.
Parameters:
Returns: Task
Exceptions:
Sets the color of an LED in a strip (e.g., WS2812).
Parameters:
Returns: Task
Exceptions:
Updates the LED strip with the set colors.
Parameters: None
Returns: Task
Exceptions: None
using PCGPIOLib;
PCGPIO gpio = new PCGPIO();
await gpio.ConnectAsync();
await gpio.SetPinModeAsync(13, PinMode.Output);
while (true)
{
await gpio.WriteDigitalPinAsync(13, true); // LED on
await Task.Delay(1000);
await gpio.WriteDigitalPinAsync(13, false); // LED off
await Task.Delay(1000);
}
using PCGPIOLib;
PCGPIO gpio = new PCGPIO();
await gpio.ConnectAsync();
await gpio.SetPinModeAsync(2, PinMode.Input);
await gpio.AttachInterruptAsync(2, InterruptMode.Rising, () =>
{
Console.WriteLine("Button pressed!");
});
© 2025 ByronAP. All rights reserved.
| Back | FazBrowse Home | New Git URL |