Skip to content

rfayat/PWM_Arduino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PWM_Arduino

Launch PWM on an arduino via a serial port using python

Python handling of the serial connexion

Clone the repository and install the package as follows:

$ https://github.com/rfayat/PWM_Arduino.git
$ cd PWM_Arduino
$ pip install .

You can then run PWM by simply running:

$ python -m pypwm.run

Parameters can also be set directly in the command line or using a json file. For this parameter file, valid keys are port, frequency, chunk_size, chunk_pause and duty_cycle. Missing parameters will be set to their default value or the one provided in the command line if any was provided. You can refer to the the script's documentation for default values and valid inputs by running:

$ python -m pypwm.run --help

Arduino setup

Dependencies and code upload

Install the Arduino PWM Frequency Library from your arduino IDE. This library is compatible with arduino Uno. To install it, download the zip file, extract it and place the directory PWM inside /path/to/Arduino/libraries/

You can then upload the code in the repository's pwm_arduino folder to your arduino.

Setting up the hardware

Circuit, for an arduino Uno: TODO: Add illustration

Warning: All pins do not support interruptions (e.g. only pins 2 and 3 on the arduino Uno), set PIN_COUNTER to a pin that can support interruptions.

About

Launch PWM on an arduino via a serial port using python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors