i have a Arduino which is connected to my PC. I'm sending some hex values over Serial port (with Python/Spyder IDE) to it to control the GPIO pins.
Is there a way to upload the sketch to the Arduino without using the IDE.
I don't want to write the sketch in python. Just want to upload a existing sketch via a Python script.
Thanks for your help!
You can build and upload Arduino sketches with python, there are two worthwhile tools: build_arduino.py and arduino-sketch.
Their pages provide detailed installation and usage instructions.
Related
Im trying to see what pyserial is writing in Putty, later on I would like to try CubeIDE STM32 to receive this data as well.
Putty gives me a port is being used error. How can I check what Python is writing to COM5?
You can use programs like for example Virtual Serial Port Driver. It can create linked virtual COM ports ,one to write and second to read data.
issue: unable to flash micropython to esp 32: open serial error, please try again. hope to connect internet and try again.
pretty new to micropython - want to flash micropython to esp 32 ( resp 8266) board.
cf this docs: https://maker.pro/esp8266/tutorial/using-micropython-on-an-esp8266-with-upycraft
getting this errors all the time.
open serial error, please try again.
hope to connect internet and try again.
current version only open py txt json ini file.
hope to connect internet and try again.
hope to connect internet and try again.
i run Win 7
the hardware:
a. Joy-IT-Node MCU ESP8266
.. and besides that i also tried it with the following
b. ESP32-T Development Board CP2102 with Espressif ESP-WROOM-32 IoT WLAN & BLE Modul
yes: i have installed the > CP210x_Universal_Windows_Driver.zip
by the way: i could try to do all that on a linux machine. - on a MX-Linux-Sytem
any idea;
many thanks for any and all help in advance.
As of my opinion, You don't necessarily depend on the uPyCraft IDE. So there are several other ways to develop scripts and uploading them to Your board.
Some days ago I was facing problems with Python on the NodeMcu as well. Since I didn't like the tutorials around the web, I've set up one on GitHub, covering the end-to-end process (required software, drivers, firmware images, developing, flashing, uploading, etc.): python2nodemcu.
It depends on Mac and the NodeMcu board, but some of the topics may apply to other operating systems and boards as well.
And I think it covers the most relevant parts of the whole process, using the easiest tools around the web. Please have a look at it, but all in all it goes like this (short version of the linked documentation above):
Install Python 3
Verify with python --version
Or python3 --version
Install the correct SiLabs driver to enable serial USB-to-UART communication
See here
Find the device file (representing the interface to the physical device)
Try it using ls -la /dev/tty.*
Download the recent MicroPython firmware
You need the right one for Your board
Install the two Python-based libraries EspTool and PySerial
Try to erase the flash of Your device
Run python3 esptool.py --port /dev/tty.{device-file} erase_flash
Try to flash the original image or the MicroPython firmware to the board
Run python3 esptool.py --port /dev/tty.{device-file} write_flash 0x00000 {micropython-image-or-original-firmware}.bin
Try to connect to the board via the REPL prompt
Run screen /dev/tty.{device-file} 115200
You maybe need to try different baud rates (depending on Your driver, cable, etc.)
Connect to the board using Ampy
For example, try to list the files on Your device executing python3 ampy/cli.py --port /dev/tty.{device-file} --baud 115200 ls
Again, try other baud rates
Anyway, I've noticed that You do not necessarily need to push the physical flash button on the device.
I am using a Raspberry Pi zero that runs on Rasbpian, and am connecting it with a computer, through a transceiver. I use minicom on the Raspberry Pi and Putty on the laptop to second documents.
I wrote some code that automatically generates files in a folder, and want to send those files through serial to my laptop the moment they are generated. I've heard that I can use rsync for this, but only read about people using it with SSH. One friend advised using piping, but I am new to this, so did not understand how to use piping with rsync.
I am new to Raspberry Pi. I need to read and write to the GPIO pins on the Raspberry Pi. I am trying to do this operation in php, python, and the command line. Do I need to download any kind of library to do this in php, python, or command line?
No, controlling GPIOs from userspace is a feature provided by the operating system. You just need to write a number to the GPIO value "file" thats provided by the kernel. It is located under /sys/class/gpio/gpio<number>/value. This should give you a kickstart. There they show how its done on the BeagleBoard with the shell but it is a general concept and it doesnt matter which language you use.
In python you can use the GPIO library
Generally in unix devices are represented as files, so you can open a file in /dev/ and read/write to the devices.
You might get more detailed help on https://raspberrypi.stackexchange.com/
Besides sysfs, the virtual filesystem that allows root to directly read from and write to GPIO pins by echo to or cat from various files in the /sys/class/gpio/ folder (as already mentioned) there are libraries available to do so. Two noteworthy examples are:
wiringPi library provides a cli command gpio to be used by non-privileged users for direct access.
pigs utility, part of the pigpio library also offers comprehensive control of the GPIO pins from the command line (see pigpio for download of source, installation procedures and excellent application examples).
I am testing a piece of hardware which hosts an ftp server. I connect to the server in order to configure the hardware in question.
My test environment is written in Python 3.
To start the ftp server, I need to launch a special proprietary terminal application on my pc. I must use this software as far as I know and I have no help files for it. I do however know how to use it to launch the ftp server and that's all I need it for.
When I start this app, I go to the menu and open a dialog where I select the com port/speed the hardware is connected to. I then enter the command to launch the ftp server in a console like window within the application. I am then prompted for the admin code for the hardware, which I enter. When I'm finished configuring the device, I issue a command to restart the hardware's software.
In order for me to fully automate my tests, I need to remove the manual starting of this ftp server for each test.
As far as I know, I have two options:
Windows GUI automation
Save the stream of data sent on the com port when using this application.
I've tried to find an GUI automater but pywinauto isn't supporting Python 3. Any other options here which I should look at?
Any suggestions on how I can monitor the com port in question and save the traffic on it?
Thanks,
Barry
Have you looked at pySerial? It's been a few years since I've used it but it was quite good at handling RS-232 communications and it looks like it's compatible with Python 3.x.
Sikuli might provide the kind of GUI automation you need.
I was also able to solve this using WScript, but pySerial was the preferred solution.