技术标签: python for arduino
作者:loxygen
### 作者邮箱:[email protected]
### 首页:https://github.com/loxygenK/oxidizer
### 文档:None
### 下载链接
# oxidizer (arduino-oxidizer)
A python tool to build Rust project for Arduino and write it.
Installation
Requirements
python3
pip
cargo
A rust project configurated to build for Arduino, or an elf file to write
If you need to make a project for it, a template loxygenK/arduino-on-rust_template is available.
avrdude
Installation
You can install oxidizer withpip
pip install arduino-oxidizer
Note: The package's name to install is arduino-oxidizer, not oxidizer.
How to use
Build and write a Cargo project configured for Arduino
Oxidizer builds the project using cargo, and write to Arduino. The target ELF file is searched based on cargo.toml.
oxidizer
example
$ cd /path/to/cargo/projects/root
$ oxidizer /dev/ttyUSB0
[i] Building 'some-nice-project' ...
[i] >> cargo build
Updating crates.io index
Finished dev [unoptimized + debuginfo] target(s) in 2.30s
[v] Building succeeded! Writing to Arduino...
[i] >> avrdude -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyUSB0 -Uflash:w:target/avr-atmega
328p/debug/some-nice-project.elf:e
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
/* ...... */
avrdude: 4982 bytes of flash verified
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done. Thank you.
[v] All works done!
Build and write in release mode
Run with the option --release (-r) , to build in release mode.
$ cd /path/to/cargo/projects/root
$ oxidizer /dev/ttyUSB0 -r
[i] Building 'some-nice-project' in release mode...
[i] >> cargo build --release
Updating crates.io index
Finished release [optimized] target(s) in 2.42s
/* ...... */
avrdude done. Thank you.
[✓] All works done!
Write your own ELF file
Run with the option --skip-cargo (-s) and --elf-path (-e) , to skip building a cargo project, and write your own ELF file to Arduino.
$ oxidizer --skip-cargo --elf-path my_own_elf_file.elf /dev/ttyUSB0
[i] >> avrdude -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyUSB0 -Uflash:w:my_own_elf_file.elf:e
avrdude: AVR device initialized and ready to accept instructions
/* ...... */
avrdude done. Thank you.
[✓] All works done!
Other options
Various options is available:
$ oxidizer --help
usage: oxidizer [-h] [--release] [--cargo-option [Option [Option ...]]]
[--avrdude-option [Option [Option ...]]] [--avrdude-override] [--avrdude-quite]
[--skip-cargo] [--elf-path ELF_PATH] [--no-color]
target
A building helper for the Rust project for Arduino.
positional arguments:
target Specify the serial port to write.
optional arguments:
-h, --help show this help message and exit
--release, -r Let cargo build in release mode
--cargo-option [Option [Option ...]], -c [Option [Option ...]]
Pass options to cargo. Type without '-'!
--avrdude-option [Option [Option ...]], -a [Option [Option ...]]
Pass options to avrdude. Type without '-'!
--avrdude-override, -A
override avrdude's option. Use with '-a'
--avrdude-quite, -q Use -q option when avrdude.
--skip-cargo, -s Skip building using cargo.
--elf-path ELF_PATH, -e ELF_PATH
Specify ELF file's path. Use target/avr-
atmega328p/{debug,release}/{package_name}.elf as default.
--no-color Disable color output.
| Option | Abbreviation | Arguments | Description | | -------------------- | ------------ | ------------------------------------------------------- | ------------------------------------------------------------ | | --release | -r | Nothing | Build the cargo project in release mode.
Cannot be used with --skip-cargo. | | --cargo-option | -c | Options to pass to cargo
(enumerate without-) | Run cargo with additional options. | | --avrdude-option | -a | Options to pass to avrdude
(enumerate without-) | Run avrdude with additional options. | | --avrdude-override | -A | Nothing | Replace the default options to pass to avrdude with the options specified in --avrdude-option. | | --skip-cargo | -s | Nothing | Skip building a cargo project. Use with--elf-path. | | --elf-path | -e | The ELF file to write | Specify the ELF file's path to write. | | --no-color | Nothing | Nothing | Print logs without ASCII espace sequences. |
oxidizer (arduino-oxidizer)
Pythonで作成された、Rustで書かれたArduinoプロジェクトをビルド・書き込むためのツールです。
インストール
必要なもの
python3
pip
cargo
Arduino用にビルドできるように構成されたRustのプロジェクト または書き込みたいelfファイル
avrdude
インストール
pipでインストールできます:
pip install arduino-oxidizer
注意: インストールするパッケージ名はoxidizerではなくarduino-oxidizerです。
使い方
Arduino用に構成されたCargoプロジェクトをビルド・書き込み
oxidizerは、cargoを用いてビルドを行い、avrdudeを用いてArduinoへ書き込みを行います。 書き込むELFファイルはCargo.tomlから読み込んだプロジェクト名を元に検索されます。
oxidizer
例
$ cd /path/to/cargo/projects/root
$ oxidizer /dev/ttyUSB0
[i] Building 'some-nice-project' ...
[i] >> cargo build
Updating crates.io index
Finished dev [unoptimized + debuginfo] target(s) in 2.30s
[v] Building succeeded! Writing to Arduino...
[i] >> avrdude -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyUSB0 -Uflash:w:target/avr-atmega
328p/debug/some-nice-project.elf:e
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
/* ...... */
avrdude: 4982 bytes of flash verified
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done. Thank you.
[v] All works done!
Cargoプロジェクトをリリースモードでビルド・書き込み
--release(-r)をつけて実行すると、リリースモードでビルドされます。
$ cd /path/to/cargo/projects/root
$ oxidizer /dev/ttyUSB0 -r
[i] Building 'some-nice-project' in release mode...
[i] >> cargo build --release
Updating crates.io index
Finished release [optimized] target(s) in 2.42s
/* ...... */
avrdude done. Thank you.
[✓] All works done!
自作のELFファイルを書き込む
--skip-cargo(-s)と--elf-path(-e)を指定して実行すると、Cargoプロジェクトのビルドをスキップし、自作のELFファイルを書き込むことができます。
$ oxidizer --skip-cargo --elf-path my_own_elf_file.elf /dev/ttyUSB0
[i] >> avrdude -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyUSB0 -Uflash:w:my_own_elf_file.elf:e
avrdude: AVR device initialized and ready to accept instructions
/* ...... */
avrdude done. Thank you.
[✓] All works done!
他のオプション
様々なオプションを利用できます:
$ oxidizer --help
usage: oxidizer [-h] [--release] [--cargo-option [Option [Option ...]]]
[--avrdude-option [Option [Option ...]]] [--avrdude-override] [--avrdude-quite]
[--skip-cargo] [--elf-path ELF_PATH] [--no-color]
target
A building helper for the Rust project for Arduino.
positional arguments:
target Specify the serial port to write.
optional arguments:
-h, --help show this help message and exit
--release, -r Let cargo build in release mode
--cargo-option [Option [Option ...]], -c [Option [Option ...]]
Pass options to cargo. Type without '-'!
--avrdude-option [Option [Option ...]], -a [Option [Option ...]]
Pass options to avrdude. Type without '-'!
--avrdude-override, -A
override avrdude's option. Use with '-a'
--avrdude-quite, -q Use -q option when avrdude.
--skip-cargo, -s Skip building using cargo.
--elf-path ELF_PATH, -e ELF_PATH
Specify ELF file's path. Use target/avr-
atmega328p/{debug,release}/{package_name}.elf as default.
--no-color Disable color output.
| オプション | 省略形 | 引数 | 説明 | | -------------------- | ------ | -------------------------------------- | ------------------------------------------------------------ | | --release | -r | なし | Cargoプロジェクトをリリースモードでビルドします。
--skip-cargoと同時に指定することはできません。 | | --cargo-option | -c | Cargoに渡すオプション(-なしで列挙) | Cargoでビルドする際に、追加でオプションをつけて実行します。 | | --avrdude-option | -a | avrdudeに渡すオプション(-なしで列挙) | avrdudeでビルドする際に、追加でオプションをつけて実行します。 | | --avrdude-override | -A | なし | avrdudeでビルドする際、規定のコマンドを--avrdude-optionで指定されたものに置き換えます。 | | --skip-cargo | -s | なし | Cargoでのビルドをスキップします。
--elf-pathと一緒に使用します。 | | --elf-path | -e | Arduinoに書き込むELFファイルへのパス | 書き込むELFファイルのパスを指定します。 | | --no-color | なし | なし | ASCIIエスケープシーケンスなしで出力を行います。 |
Copy from pypi.org
文章浏览阅读1.8k次,点赞4次,收藏6次。python简易爬虫v1.0作者:William Ma (the_CoderWM)进阶python的首秀,大部分童鞋肯定是做个简单的爬虫吧,众所周知,爬虫需要各种各样的第三方库,例如scrapy, bs4, requests, urllib3等等。此处,我们先从最简单的爬虫开始。首先,我们需要安装两个第三方库:requests和bs4。在cmd中输入以下代码:pip install requestspip install bs4等安装成功后,就可以进入pycharm来写爬虫了。爬
文章浏览阅读2.6k次。解决方法:解决方法可以去github重新下载一个pyflakes.vim。执行如下命令git clone --recursive git://github.com/kevinw/pyflakes-vim.git然后进入git克降目录,./pyflakes-vim/ftplugin,通过如下命令将python目录下的所有文件复制到~/.vim/ftplugin目录下即可。cp -R ...._freetorn.vim
文章浏览阅读210次,点赞7次,收藏3次。本文简述了hello.c源程序的预处理、编译、汇编、链接和运行的主要过程,以及hello程序的进程管理、存储管理与I/O管理,通过hello.c这一程序周期的描述,对程序的编译、加载、运行有了初步的了解。_hit csapp
文章浏览阅读1w次,点赞2次,收藏27次。来源:机器人小妹 很多时候企业拥有重复,乏味且困难的工作流程,这些流程往往会减慢生产速度并增加运营成本。为了降低生产成本,企业别无选择,只能自动化某些功能以降低生产成本。 通过数字化..._人工智能平台
文章浏览阅读2.2k次。热加载能够在每次保存修改的代码后自动刷新 electron 应用界面,而不必每次去手动操作重新运行,这极大的提升了开发效率。安装 electron 热加载插件热加载虽然很方便,但是不是每个 electron 项目必须的,所以想要舒服的开发 electron 就只能给 electron 项目单独的安装热加载插件[electron-reloader]:// 在项目的根目录下安装 electron-reloader,国内建议使用 cnpm 代替 npmnpm install electron-relo._electron-reloader
文章浏览阅读942次。在11.0 进行定制化开发,会根据需要去掉recovery模式的一些选项 就是在device.cpp去掉一些选项就可以了。_android recovery 删除 部分菜单
文章浏览阅读2.2k次,点赞2次,收藏6次。继续上次的echart博客,由于省会流向图是从echart画廊中直接取来的。所以直接上代码<!DOCTYPE html><html><head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /&_java+echart地图+物流跟踪
文章浏览阅读1.4k次。一、OSD模块简介1.1 消息封装:在OSD上发送和接收信息。cluster_messenger -与其它OSDs和monitors沟通client_messenger -与客户端沟通1.2 消息调度:Dispatcher类,主要负责消息分类1.3 工作队列:1.3.1 OpWQ: 处理ops(从客户端)和sub ops(从其他的OSD)。运行在op_tp线程池。1...._ceph 发送数据到其他副本的源码
文章浏览阅读7.9k次,点赞3次,收藏22次。一 定义这是最早出现的置换算法。该算法总是淘汰最先进入内存的页面,即选择在内存中驻留时间最久的页面予以淘汰。该算法实现简单,只需把一个进程已调入内存的页面,按先后次序链接成一个队列,并设置一个指针,称为替换指针,使它总是指向最老的页面。但该算法与进程实际运行的规律不相适应,因为在进程中,有些页面经常被访问,比如,含有全局变量、常用函数、例程等的页面,FIFO 算法并不能保证这些页面不被淘汰。这里,我_进程调度fifo算法代码
文章浏览阅读133次。rownum是oracle才有的写法,rownum在oracle中可以用于取第一条数据,或者批量写数据时限定批量写的数量等mysql取第一条数据写法SELECT * FROM t order by id LIMIT 1;oracle取第一条数据写法SELECT * FROM t where rownum =1 order by id;ok,上面是mysql和oracle取第一条数据的写法对比,不过..._mysql 替换@rownum的写法
文章浏览阅读790次,点赞3次,收藏4次。官网下载下载链接:http://www.eclipse.org/downloads/点击Download下载完成后双击运行我选择第2个,看自己需要(我选择企业级应用,如果只是单纯学习java选第一个就行)进入下一步后选择jre和安装路径修改jvm/jre的时候也可以选择本地的(点后面的文件夹进去),但是我们没有11版本的,所以还是用他的吧选择接受安装中安装过程中如果有其他界面弹出就点accept就行..._ecjelm
文章浏览阅读245次。原文链接:https://linux.cn/article-7801-1.htmlifconfigping <IP地址>:发送ICMP echo消息到某个主机traceroute <IP地址>:用于跟踪IP包的路由路由:netstat -r: 打印路由表route add :添加静态路由路径routed:控制动态路由的BSD守护程序。运行RIP路由协议gat..._ifconfig 删除vlan