Crates.io | pwm_gen |
lib.rs | pwm_gen |
version | 0.1.3 |
source | src |
created_at | 2024-11-22 12:39:32.346467 |
updated_at | 2024-11-22 15:27:36.502506 |
description | A simple PWM signal generator in Rust |
homepage | |
repository | |
max_upload_size | |
id | 1457361 |
size | 3,526 |
Created by bensatlantik
pwm_gen
is a simple Rust application that generates a Pulse Width Modulation (PWM) signal. This program demonstrates the basic concept of PWM by simulating PWM signals via console output. This version is for educational purposes.
To make your PWM generator control GPIO pins, you'll typically use a library specific to the hardware platform:
rppal
crate for GPIO control.stm32f4xx-hal
crate.embedded-hal
crate provides a hardware abstraction layer for embedded devices.Clone the repository and navigate to the project directory:
git clone https://github.com/yourusername/pwm_gen
cd pwm_gen
Build and run the application using Cargo:
cargo build --release
./target/release/pwm_gen
You can adjust the duty cycle and frequency by modifying the parameters in src/main.rs:
fn main() {
let pwm = Pwm::new(0.5, 1); // 50% duty cycle, 1 Hz frequency
pwm.start();
}
This project is licensed under the MIT License
bensatlantik