在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:ylabrj/jam开源软件地址:https://github.com/ylabrj/jam开源编程语言:Jupyter Notebook 93.9%开源软件介绍:jam - Jupyter Notebook and Arduino Mash-Up using cell magicsFormerly jarduino until I found out the java people already used that nameDesigned for the Iron Python Kernel DEVELOPMENT NOTE 2020-03-22
WARNINGS:
OverviewMany developers use Arduino boards to generate data to bring into a Jupyter Notebook, but need to compile/load/run their Arduino code from the Arduino IDE. This code provides Jupyter Notebook magics to allow Arduino C (sketch) code in a Python cell to be compiled and loaded to the Arduino board by making use of the command line features of the arduino command. The code is designed to be as compatible as possible with the behaviour of the Arduino IDE and its serialplotter functions, while offering improved support for parameters at the cell and magic level for:
The magic supports the Arduino IDE's directory/file structure for saving sketch files (.ino), where, by default:
To keep the notebook tidy, all the sketch directories are kept under directory sketches. A design document with tutorial code and usage examples will be provided later. Tutorial on jam - and on running Arduino sketches without jam.The Integrating Arduino and Jupyter tutorial in this repository is a Jupyter notebook, so it cannot be viewed directly. The link makes it available through nbviewer. The tutorial takes you through some usage scenarios and design decisions. Useful, because it shows you how to use some of the default magics to save and run Arduino code without jam. But hopefully you'll agree that it's better with jam. Installation
The functions are available through two magics:
Test and get current parameters by entering the following in a Python cell:
%%jamcell
Parameters:
Optional arguments:
Usage example: the following in a Python cell
With the same Arduino code in the cell:
%jamProvides utility functions to identify connected Arduino boards and ports and provide plotting assistance. Plotting configuration is defined later in this README. Parameters - simple utility
Parameters - operations on existing sketch files
''' %jam --sketch i2csketch --port COM5 --board uno --redefine I2C_ADDR 04 %jam --sketch i2csketch --port COM6 --board micro --redefine I2C_ADDR 06 %jam --sketch i2csketch --port COM8 --board mega --redefine I2C_ADDR 08 ''' Plotting considerationsCompatibility with Arduino IDE serialplotterThe serial plotter on the Arduino IDE expects numbers in character string separated by tabs or spaces. If there are multiple numbers on the line, it will make multiple plots. Static plotting with --plotThe --plot XX option behaves the same way as the Arduino IDE but is not a dynamic plot. It accumulates XX data points (from Serial.println() in the Arduino sketch) and then plots them all all at once. The plots overlap. Adding the --stack option separate the plots by stacking the graphs. External live plottingWe're still working on having live plots inside the notebook. In the interim, you can specify an external plotter by adding --plotext . The external plotter must support the same ASCII number format from the Serial.println() output. must be configured in the system path or entered with a fully-qualified path. The Arduino IDE serialplotter cannot be called up directly from the command line. You can enter --plotext Arduino but then you'll need to execute the pulldown menu option and specify the serial port to start it. Caution: Starting the Arduino IDE serial plotter resets the Arduino board. serialplot is a free option we like that has great performance. You may need to specify the port, and then hit the start button to start plotting. Known issuesSo far only tested on Windows 10 and Raspberry Pi Raspbian 4.14 Thanks to Calin Graza for starting the MAC testing. --redefine works on numbers and strings - but the C/sketch compiler only supports numbers. Duh. If the underlying program (plotter, Arduino IDE) errors out or there is contention on the serial port, the IPython kernel can be locked up. Restarting the kernel fixes it nicely. Still working on getting live plotting working. MAC Darwin, Linux and Raspberry Pi serial port issues.The Windows operating system information calls identify ports as connected to Arduino devices directly in the Python serial library calls. The magics use this to identifythe Arduino ports and/or verify that a selected port is an Arduino port. Mac/Darwin and Linux do not provide this info to the Python serial library , so port checks are not performed. Serial port listing functions simply list all the available serial ports. The documentation says the IDE will recall the last port used, but we have found this unreliable. Always specify the --port. Also good practice to specify the board type with --board. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论