Am pretty familiar (no expert) in using Python to include code for RPi. Recently purchased BBB for which some of my code is not working (one example is for the DHT22 Hum/Temp sensor). SO, I gather I need CP.
My question: Can CP libraries be imported into Python 3+ and used with standard Python coding, or does CP language have to be used throughout?
BTW, I use straight text editors or IDLE for coding and do not use Cloud based or MU
I really don't want to have two coding platforms.
Any help would be appreciated!
Confused about CircuitPython
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
- rainerf
- Posts: 3
- Joined: Sat May 28, 2022 12:26 pm
Re: Confused about CircuitPython
Dave,
TY kindly. I have read through that once before, and, the second time now, it makes a little more sense.
The samples appear to be CP language, though, yes? Could you think of any sample code which involves both Python3 and CP?
I am sorry to be so dense, but I am really trying to understand it better.
TY kindly. I have read through that once before, and, the second time now, it makes a little more sense.
The samples appear to be CP language, though, yes? Could you think of any sample code which involves both Python3 and CP?
I am sorry to be so dense, but I am really trying to understand it better.
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Confused about CircuitPython
CircuitPython and MicroPython that it's based on are Python 3, but a from scratch implementation running on microcontrollers. Ignoring the version that runs native on the Pi (i.e. no Linux).
Blinka is a layer that lets you use libraries/modules that are written for CircuitPython with cpython (the "standard" implementation) on supported platforms (e.g. various Raspberry Pi boards).
So the language is the same. The difference is that various low level modules that are part of the CircuitPython runtime. A good example of that is the board module. Blinka brings those modules to Python3, letting you use the various hardware support/driver modules. E.g. sensor drivers and such.
That guide is full of examples of using CircuitPython modules with cpython running on a Pi (or other support linux board).
Dave
Blinka is a layer that lets you use libraries/modules that are written for CircuitPython with cpython (the "standard" implementation) on supported platforms (e.g. various Raspberry Pi boards).
So the language is the same. The difference is that various low level modules that are part of the CircuitPython runtime. A good example of that is the board module. Blinka brings those modules to Python3, letting you use the various hardware support/driver modules. E.g. sensor drivers and such.
That guide is full of examples of using CircuitPython modules with cpython running on a Pi (or other support linux board).
Dave
- rainerf
- Posts: 3
- Joined: Sat May 28, 2022 12:26 pm
Re: Confused about CircuitPython
Dave - TY again for taking the time.
That is the portion I needed to understand!
Silly enough on my part, I have seen modules described using cPython but did not know that was the nomenclature for the common python language. Again, TY
That is the portion I needed to understand!
Silly enough on my part, I have seen modules described using cPython but did not know that was the nomenclature for the common python language. Again, TY
- dastels
- Posts: 15662
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Confused about CircuitPython
Good stuff. Have fun.
Dave
Dave
Please be positive and constructive with your questions and comments.