background preloader

PyMCU - The Python Controlled Microcontroller

PyMCU - The Python Controlled Microcontroller

python - real-time plotting in while loop with matplotlib Raspberry Pi, mini computers, Android and microcontrollers General electronics Handling LCD displays via USB UART from your computer - How to control displays from computers via serial UART communications in PythonRemote programming of mini PC like Raspberry Pi or Beaglebone Black - How to use SSH, SSHFS and VNC/RDP to remotely programm and operate an mini PC from another PC. Micro Python and pyboard Micro Python and pyboard - a Python running on a microcontroller scripts your electronics - How doeas a Python works on a microcontroller and what features pyboard board can offer us? Raspberry Pi Benchmarking Raspberry Pi performance - How does Raspberry Pi compares to other computers in terms of performance? Other Single board computers Benchmarking Beaglebone Black single board computer - What capabilities and performance does Beaglebone Black offers to hardware hackers and makers? Android pyMCU Hardware Other boards

Appliquer un traitement à tous les fichiers d’un dossier en Python Opération courante en informatique et on a tous eu besoin de chercher comment faire une fois. Soit l’arborescence : test ├── dossier │ ├── fichier.py │ ├── fichier.txt │ └── pas_un_dossier.txt ├── Dossier │ ├── dOssier │ │ └── faichier │ └── fichiiiiiiiiier ├── .fichier ├── fichier ├── fIchier └── Fichier Lister le contenu d’un dossier On récupère les noms des dossiers et les fichiers, y compris cachés, mais pas les dossiers spéciaux types .. et .. Le type des noms retournés est str que ce soit en Python 2 ou 3. Si vous voulez récupérer uniquement les dossiers ou les fichiers, il va falloir filtrer : Pareil si on veut filtrer par extensions : Néanmoins, Python vient avec le module glob qui permet de demander le listing du contenu d’un dossier en appliquant des filtres Unix : Même problème Python 2/3 : le type est str dans les 2 cas. Parcours récursif La fonction os.walk permet de lister récursivement tous les fichiers et les dossiers à partir d’un point dans l’arborescence.

Matthew McMillan: pyMCU and DS18B20 temperature sensors As part of my Garage Monitor project I am using a Maxim DS18B20 digital temperature sensor with a pyMCU microcontroller. I found lots of pages and sample code for using the DS18B20 with Arduino boards and various other microcontrollers but nothing for the pyMCU. The pyMCU uses a Python library published by the board manufacturer to control it. The DS18B20 uses the 1-Wire communication bus and the pyMCU Python library includes functions for 1-Wire communication called owWrite and owRead. The tricky part is figuring out the command sequence to coax a temperature reading out of the sensor. It took me the better part of three evenings to figure out the sequence of writes and reads. The pyMCU 1-Wire function uses this format: owWrite(pinNum, mode, writeData) The mode value determines if a reset pulse is sent before or after the data. And is the code that I wrote: #! Please leave a comment if you found this helpful.

Jython Scripting - Fiji The Jython interpreter plugin The interpreter provides a screen and a prompt. Type any jython code on the prompt to interact with ImageJ. Launch it from plugins - Scripting - Jython Interpreter. See Scripting Help for all keybindings, and also Scripting comparisons. Within the interpreter, all ImageJ, java.lang.* and TrakEM2 classes are automatically imported. Language basics Any text after a # is commented out. Importing classes To reference Java classes from Jython you will need to import them. You can specify imports in Jython as follows: Where java.io.File is the class to be imported. Workflow for creating Jython scripts To create a script for the GUI, the recommended setup is the following: Edit and save a file in your favorite text editor. The next time Fiji is run, it will setup all your scripts in the Plugins menu. If all you need is a script to run in headless mode, simply do: fiji --headless filepath.py Some limitations of jython For instance, Instead, to create a NaN in jython, use:

Related: