- Notifications
You must be signed in to change notification settings - Fork1
🐍 Damn Small Python compiler designed for use on Arduino for educational purposes. Based on LLVM.
License
tdh8316/DSPython
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The new version of DSPython is now under the development indev branch!
DSPython is in the very initial stage of a development phase and should not be used in a production environment.
You can browse theexamples directory to learn how DSPython interacts with Arduino.
Are you disappointed? Please consider contributing!
🐍 Python compiler intended to use in Arduino.
TheMicropython project aims to put an implementation of Python 3 on microcontrollers, but it is not for Arduino.
DSPython usesLLVM to provide a way to compile programs written in thePython programming language.The generated LLVM bytecode is intended to be similar to C++'s.
Accordingly,DSPython is internally not a Python at all.
Here is an example program that blinks the built-in LED of Arduino Uno:
# Blink the built-in LED of Arduino Uno!fromarduinoimport*defsetup():pin_mode(13,1)defloop():digital_write(13,1)delay(1000)digital_write(13,0)delay(1000)
To compile and upload this source, you can specify the serial port to upload by providing the--upload-to option.For example, this compiles and uploads theblink example to the Arduino:
dspython examples/Blink.py --upload-to YOUR_PORTCurrently, All examples have been tested only on Arduino Uno.
- LLVM 10 (include llvm-config)
On Windows, the official LLVM releases do not contain many important components.You have to usepre-built LLVM binary built forZiglang
- Arduino IDE
You have to set the environment variable namedARDUINO_DIR to your arduino IDE location.This is because DSPython requires Arduino standard headers, avr-gcc compiler, and avrdude.
Contributions are more than welcome!
This is my first project using LLVM and Rust language.Please share your opinions. Any ideas would be highly appreciated!
- Damn small binary size
- Support Arduino or microcontrollers
- Programming Arduino with seemingly Python-like language
These are not impossible, but currently not our goals.
- Compile to other platforms
- Garbage collector
- Class and inheritance
- Complete Python implementation
- Compile all python standard libraries
- Support threading or asynchronous functions
I wanted to program Arduino in other languages as well as C++ and thought the Python language would be a good choice.That's why I decided to make a Python compiler that is available to upload directly to the Arduino.
The distinctive feature of DSP is that it uses LLVM internally instead of emittingC++.
Licensed under the MIT License
Copyright 2022Donghyeok Tak
- The python parser is based onRustPython
- Value handler fromtestlang
- LLVM binding for rust isInkwell
About
🐍 Damn Small Python compiler designed for use on Arduino for educational purposes. Based on LLVM.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.