micropython | Experiments with micropython and canbus

 by   hmaerki Python Version: Current License: No License

kandi X-RAY | micropython Summary

kandi X-RAY | micropython Summary

micropython is a Python library typically used in Internet of Things (IoT) applications. micropython has no bugs, it has no vulnerabilities and it has high support. However micropython build file is not available. You can download it from GitHub.

This repositoriy documents experiments with micropython and the CAN-bus.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              micropython has a highly active ecosystem.
              It has 16 star(s) with 4 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              micropython has no issues reported. There are no pull requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of micropython is current.

            kandi-Quality Quality

              micropython has no bugs reported.

            kandi-Security Security

              micropython has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              micropython does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              micropython releases are not available. You will need to build from source code and install.
              micropython has no build file. You will be need to create the build yourself to build the component from source.

            Top functions reviewed by kandi - BETA

            kandi has reviewed micropython and discovered the below as its top functions. This is intended to give you an instant insight into micropython implemented functionality, and help decide if they suit your requirements.
            • Lists all pins .
            • Called when the controller exits .
            • Print the LED information .
            • Main loop .
            Get all kandi verified functions for this library.

            micropython Key Features

            No Key Features are available at this moment for micropython.

            micropython Examples and Code Snippets

            No Code Snippets are available at this moment for micropython.

            Community Discussions

            QUESTION

            s.bind((hostIPAddress,22)) OSError: 99
            Asked 2021-Jun-14 at 12:25

            I am trying to get my robot to communicate with my PC via sockets by using local IP addresses on my own home network (not devices outside my network). The robot is acting as the server and my own PC is acting as the client/host. I don't really know what ports are open on my robot but I do definitely know that port 22 on the robot is open (which is the SSH port). The robot is a lego EV3 robot apart from it has had some ev3python software put onto it. When I run my program I am getting the following error on the server (my robot):

            ...

            ANSWER

            Answered 2021-Jun-14 at 12:24
            hostIPAddress = "xx.xx.xx.xx" #the local IP address of my PC on my home network 
            backlog = 1
            size = 1024
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            s.bind((hostIPAddress,22))#22 is the port number I am using. (THIS IS ALSO THE LINE WHERE THE ERROR IS COMING FROM) 
            s.listen(backlog)
            

            Source https://stackoverflow.com/questions/67969893

            QUESTION

            HOW to setup Windows 10 + VSCode + pymakr for Python programming + Micropython + ESP-IDF for esp32?
            Asked 2021-Jun-11 at 19:32

            I started several attempts to get this complex working. As mentioned in so many other discussions the micropython modules are not recognized, e.g. machine. Python modules like numpy were also not found.

            I think, the python environment is not working correctly and the modules are there but not found. But, there is no recommendation or tutorial that really solves this. How can I set this up?

            What I did so far:

            1. manually installed all components according to tutorials

            2. another way: installed the pything coding pack which contains a lot of stuff.

            3. The Windows paths have the correct folder paths to the components.

            4. I set the obviously correct python interpreter in vscode

            5. connection/communication with board is working. I can set up codes which dont contain micropython modules.

            6. in other IDE's like thonny/mu the modules are found.

            7. I also installed a python venv: I could install numpy inside this venv and later it was found in vscode (wasn't found before) when I used the venv python as interpreter in vscode. But I wasn't succesful with micropython in venv.

            PS: I can use the micropython modules like machine or network and upload the sketch to the esp32 board. It is working on the board. But I cant run any of the sketches in vscode. I think that Vscode uses cpython instead of micropython but shouldn't this be working after the installations I mentioned?

            ...

            ANSWER

            Answered 2021-May-24 at 00:00

            It sounds like you're confusing modules you install on the machine running Visual Studio Code and modules you install in Micropython on the ESP32.

            They're totally separate.

            Python on your Windows machine can use venv.

            MicroPython doesn't use venv at all (there apparently is a clone of venv for MicroPython but it's not readily apparent what it does or why or how you'd use it). It is a completely separate instance of Python from the one on your Windows machine, and it doesn't operate the same way. Modules you install under venv won't be visible or usable by MicroPython. Numpy in particular is not available for MicroPython.

            Many modules need to be written specially to work with MicroPython. MicroPython isn't running in a powerful operating system like Windows, MacOS or Linux. It's running in a highly constrained environment that lacks much of the functionality of those operating systems, and that has extremely little memory and storage compared to them. You can't expect that a module written for regular Python will just work on MicroPython (and likewise, many MicroPython modules use hardware features like I2C or SPI access that may not be available on more powerful, general purpose computers).

            Only modules available with upip will be available for MicroPython. They'll need to be installed in the instance of MicroPython running on the ESP32, not in the instance of Python running under Windows. They're two, totally separate instances of Python.

            Source https://stackoverflow.com/questions/67647095

            QUESTION

            Micropython: [Errno 19] ENODEV but i2c.scan() returns proper address
            Asked 2021-May-26 at 22:27

            I am currently using an SRF-10 sensor connected to an esp32. It's being powered by 5V and I am using a level converter to bring down the voltage to 3.3V to be able to use it on the esp32. Both the SCL and SDA have a 1.8K pull up resistor as recommended on the datasheet. I have written the following script to try to get a read from the sensor. I am not entirely sure if it is correct but soon as it reaches line 16 I get an error saying [Errno 19] ENODEV. Eveything I could find suggests that the i2c connection isn't working properly but when I run i2c.scan() it returns the sensor address so I am guessing connections aren´t the problem. My script is as follows:

            ...

            ANSWER

            Answered 2021-May-26 at 22:27

            The proper use of i2c.writeto_mem requires the following order of arguments:

            Source https://stackoverflow.com/questions/67703244

            QUESTION

            SparkFun RP2040 and MicroPython
            Asked 2021-May-22 at 03:44

            I am a software engineer working on a microcontroller system for a side project. The microcontroller I am using is the SparkFun ProMicro (based on the RP2040 board). I am trying to flash the board so that I can write data to the onboard flash memory.

            All of the tutorials I have found online suggest starting in boot mode, dragging and dropping the UF2 file, and done!

            When I do this, the microcontroller ejects from my computer. Is that meant to happen? It just reboots then doesn't reboot in bootloader?

            Once I got MicroPython installed I moved on to writing and flashing code to the board.

            I am using the Thonny IDE which identified the correct board (albeit the PICO), then saved the following file as main.py (taken from RPI foundation). It prints toggle, and I believe the output shows that it is being printed from the board, but the light on the board isn't blinking. (code and output below)

            I considered that the pinout could be different from this board and the PICO, but some research shows they both use Pin 25 for the LED control.

            All this leads me to believe I am on the right path, but I think I am missing something that is taken for granted in the tutorials. My end goal is to write arbitrary text data to flash storage, but I understand it can only take about 8000-10,000 writes before it becomes unreliable, so I want to test that I can write working code before I use some of those.

            Is there something I am missing, or am I not thinking about this in the right way?

            ...

            ANSWER

            Answered 2021-May-18 at 03:31

            When I do this, the microcontroller ejects from my computer. Is that meant to happen? It just reboots then doesn't reboot in bootloader?

            Yep.

            but the light on the board isn't blinking.

            Maybe your LED is busted, cause your code is right.

            My end goal is to write arbitrary text data to flash storage

            That's a terrible idea, unless you just like burning up boards for no good reason. Get an SD Card reader or concoct one out of a solution like this one, and use this sdcard library that will even mount your card, and add it to the syspath. Then you can essentially write all the arbitrary text data you like without burning up your RP2040.

            Source https://stackoverflow.com/questions/67574800

            QUESTION

            ImportError: no module named 'smbus2'
            Asked 2021-May-19 at 08:57

            I'm using Pymakr on VScode to program a Pycom L01, which is connected to several sensors. i'm trying to use smbus2 library, but i can't import it.
            I created a python virtual enviroment and installed it using 'pip install smbus2', but when i try to upload the sketch, the output is:

            ...

            ANSWER

            Answered 2021-May-19 at 08:41

            May be You have not installed smbus2 module. Please install it and import it in your program.

            Source https://stackoverflow.com/questions/67599558

            QUESTION

            Is GC Broken on RPi Pico
            Asked 2021-Apr-27 at 15:55

            I am using the latest stable release of micropython and below is my entire program.

            ...

            ANSWER

            Answered 2021-Apr-27 at 15:55

            It appears that 64kb of RAM are automatically allocated to fit the firmware.elf. So, not only do you not actually get 264k of RAM (due to Hypervisor using 8k), but you don't get 256k of RAM either. Changing the edit in my question to:

            Source https://stackoverflow.com/questions/67284344

            QUESTION

            Convert CRC16 CCITT code from C to Python
            Asked 2021-Apr-15 at 20:55

            I want to do a Python implementation (actually MicroPython) of a specific checksum calculation based on CRC16-CCITT. It will be used on a microcontroller to check data integrity over a serial connection.

            The algorithm is available as C implementation.

            The checksum is a 16 bit, type CCITT. The checksum starts at the first byte of the message. Sample code to calculate the CRC16 CCITT in the C language:

            ...

            ANSWER

            Answered 2021-Apr-15 at 20:55

            The CRC implemented in the provided Python code is not the CCITT CRC-16. It is referred to interestingly as a false CCITT CRC-16 in this catalog. The CRC implemented in the provided C code is in fact the CCITT CRC-16.

            The Python code is easily modified to reflect the correct definition:

            Source https://stackoverflow.com/questions/67115292

            QUESTION

            FtpWebRequest to Microcontroller always results in (451) Local error in processing
            Asked 2021-Apr-13 at 17:42

            I'm writing a Windows Forms application in C# that allows a user to connect to a microcontroller and upload program files via FTP.

            I can successfully upload program files via Filezilla. But when I run the code below I receive the error "The remote server returned an error: (451) Local error in processing." at the line "ftpstream.Close();" every single time no matter what file I try to upload, regardless of size or file type, and the new file does show up in Filezilla on the FiPy but with a size of 0 bytes.

            I've erased all program files on the microcontroller so I know storage space is not the issue and I don't think its a firewall issue since I can upload successfully through Filezilla.

            The WebException thrown shows no extra details in the InnerException and the StatusDescription comes back as an empty string.

            I posted this question to the forum for the specific microcontroller I'm using but didn't get a solution. Here's the link to that post, it includes FTP logs and some solutions that were tried in the comments: https://forum.pycom.io/topic/6937/fipy-ftp-upload-in-c-returns-451-local-error-in-processing

            I've exhausted all google results.

            Can anyone help me out?

            My code:

            ...

            ANSWER

            Answered 2021-Apr-13 at 17:42

            I got it to work with FluentFTP. I'm not 100% sure what the issue was, maybe using CWD fixed it, maybe some underlying logic/command in FluentFTP handled it better, either way, the FTP log now more closely matches the one from Filezilla and no more errors!

            My New Code:

            Source https://stackoverflow.com/questions/67011710

            QUESTION

            PICO hangs on micropython object creation
            Asked 2021-Apr-06 at 15:24

            I recently started working on a small driver for the raspberry pico and the bme280 sensor. I wanted to use the official bosh API written in C and therefore decided to write all the code in C using the micropython C api to write usermodules. I managed to get my code compiled into a UF2 file and my module shows up when I try to list the modules with help('modules'). When I import my module the class with the driver code shows up in dir(mymodule) but when I try to create an object the terminal connected to the PICO hangs and doesn't respond anymore.

            ...

            ANSWER

            Answered 2021-Apr-06 at 08:58

            You have .print defined but it doesn't exist in your code.

            Source https://stackoverflow.com/questions/66952337

            QUESTION

            Problem when running Threads in MicroPython with ESP32
            Asked 2021-Apr-06 at 03:34

            I have the following code. I want to run it on an ESP32. The MicroPython is already installed. The problem is that nothing happens. I get no errors but the testThread() method is not called at any time. I really don't know where the problem lies.

            Thank you in advance for your answers.

            Code:

            ...

            ANSWER

            Answered 2021-Apr-06 at 03:34

            Same problem with esp32 thread execution - no output from thread function invoking a print statement. Not only that when the thread exited it crashed the esp32.

            However, I fortunately had another esp32 and the threaded function worked as expected, output was printed to the repl.

            The problem seems to be the latest version of micropython which can be checked by executing uos.uname().

            The working version 1.12.0 while version 1.14.0 fails.

            The uname output:

            Source https://stackoverflow.com/questions/66924762

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install micropython

            You can download it from GitHub.
            You can use micropython like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/hmaerki/micropython.git

          • CLI

            gh repo clone hmaerki/micropython

          • sshUrl

            git@github.com:hmaerki/micropython.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link