Launch PWM on an arduino via a serial port using python
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.runParameters 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 --helpInstall 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.
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.