Python, MicroPython...
 
Notifications
Clear all

Which (if any) of these Python-related topics do you find interesting? Poll is created on Feb 16, 2021

  
  
  
  
  

Python, MicroPython, CircuitPython

156 Posts
32 Users
65 Likes
6,813 Views
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@zander

Posted by: @zander

@frogandtoad I did, and I installed both. The PRO icon is Black round. The 2.0 RC5 is square green. I am pretty sure I already showed you both on screen at the same time before attached is a screen shot with all 3 IDE's open at the same time and the names circled in Red, 1.0 1.8.19, 2.0.0-rc5 and Pro IDE - Alpha 0.1.4.

IDEx3

 

No, there are only 2 Arduino IDE's that I am aware of... I believe you're looking at an old link of the alpha version, but that git site is no longer valid.  I do recall seeing a note that there was now a new git site for the downloads, which is now at rc5 - The alpha is no longer... just look at the last updated timestamps.

Better to just get the latest from here (nightly builds), and you can also check up on the latest bugs via the issue tracker link on the same page:

arduino-ide (nightly builds and issue tracker)


   
ReplyQuote
Ron
 Ron
(@zander)
Illustrious Member
Joined: 2 years ago
Posts: 4455
 

@frogandtoad I did notice and commented about it being archived and read-only but didn't know for sure if that meant it was a dead product or what. It is VERY different from IDE 2.0-rc5. More like PlatformIO/VisualStudio and perhaps when Msft made VS free they decided to not bother with another IDE. 

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@zander

Posted by: @zander

@frogandtoad I did notice and commented about it being archived and read-only but didn't know for sure if that meant it was a dead product or what. It is VERY different from IDE 2.0-rc5. More like PlatformIO/VisualStudio and perhaps when Msft made VS free they decided to not bother with another IDE. 

It's not dead... it's the same project, just moved to a new site long ago, and since advanced to the beta rc5 version.  Just go by the nightly downloads and issue tracker to keep up to date with it's evolution.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 
Posted by: @frogandtoad

@zander

Posted by: @zander

@frogandtoad I did notice and commented about it being archived and read-only but didn't know for sure if that meant it was a dead product or what. It is VERY different from IDE 2.0-rc5. More like PlatformIO/VisualStudio and perhaps when Msft made VS free they decided to not bother with another IDE. 

It's not dead... it's the same project, just moved to a new site long ago, and since advanced to the beta rc5 version.  Just go by the nightly downloads and issue tracker to keep up to date with it's evolution.

For anyone interested in testing out the latest Arduino Pro IDE, candidate "rc6" has been released.


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Illustrious Member
Joined: 2 years ago
Posts: 4455
 

@frogandtoad My most profound apologies. You are correct that the new IDE 2.0 is the PRO version. The interface is different, but the functionality of 2.0 is very close to the Alpha version I was looking at. 

I just downloaded the IDE2 RC6 and made a couple of discoveries. The first is that the new IDE has fairly comprehensive debug tools, I totally missed seeing that the first time I looked at it and was the main reason for me thinking there was another more 'pro' version. The second discovery is its ability to work with the cloud based sketches. 

I think it compiles faster too, but loads slower.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
frogandtoad reacted
ReplyQuote
darup
(@darup)
Trusted Member
Joined: 12 months ago
Posts: 61
 
Posted by: @dronebot-workshop

Or perhaps you have another "Python-related" idea that I haven't thought of?

Never had much use for Python or microPython until one day I acquired an RPi Pico (already had an Arduino).  Out of the box, the RPi Pico just looked at me dangling at the end of a USB cable doing nothing.  Thonny wasn't of much use to me either; nor was "Blinky."  I have not done "Blinky" but I did think about some material I saw on the dronebotworkshop about building a drone.  RPi Pico (or other microController) and a homeBuilt drone using microPython made sense.  For a beginner there would be something tangible and useful.  For the intermediate the programming of GPIO pins and Hats would be a worthy challenge. For the drone flyer, it would be the project extraordinary.

It would be a worthy opportunity to learn something useful about microProcessors and realTime applications.  Integrating programming knowledge and skills at the bareMetal level (almost) with realWorld application (homeBuilt Drone) in a project that is much more than "Blinky!" Integrating a motorized situation (four spinning propellers at synchronized speed and variable-speed by-motor), connecting a GPS head to the homeBuilt UAV will provide considerable insight to UART and GPIO usage.  For the expert, debugging skills would be the challenge.

So now I have a use for Python ('c' and java, and assembler for backup if Python is a little to slow for some programming parts) should there be a videoSeries created for microPython on a microController!

 

吉姆 | 짐 | ジム | Джим | ဂျင်မ် ਜਿੰਮ | Pīšlis | জিম | រមមមមុយ


   
ReplyQuote
(@jasline123)
Eminent Member
Joined: 7 months ago
Posts: 20
 

Any chance you can clarify/know if you can make multiple I2C buses on a Pico in CP to deal with using two I2C devices with the same address, or if there's another way to do it without a multiplexer?


   
ReplyQuote
Ron
 Ron
(@zander)
Illustrious Member
Joined: 2 years ago
Posts: 4455
 
Posted by: @jasline123

Any chance you can clarify/know if you can make multiple I2C buses on a Pico in CP to deal with using two I2C devices with the same address, or if there's another way to do it without a multiplexer?

I don't know of any way without a multiplexer.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
(@jasline123)
Eminent Member
Joined: 7 months ago
Posts: 20
 

@zander Thanks Alot


   
ReplyQuote
Ron
 Ron
(@zander)
Illustrious Member
Joined: 2 years ago
Posts: 4455
 

@jasline123 Let me waffle a bit on that. Since there are 2 controllers, it might be possible using some lower level code to disable first one controller then the other and deal with the 2 devices on one address. You will need to dig into detailed specs and the pico_sdk to see if it is possible. I have a copy and just took a quick look but I don't see anything I can read to tell me one way or the other. You might get a better/quicker answer on the raspberry pi site.

EDIT I just found some info and it looks doable at first glance

https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__i2c.html

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
(@jasline123)
Eminent Member
Joined: 7 months ago
Posts: 20
 

@zander Oh that is helpful...Thanks a lot..il check in that site... 🙂 🙂 🙂 


   
ReplyQuote
Ron
 Ron
(@zander)
Illustrious Member
Joined: 2 years ago
Posts: 4455
 

@jasline123 I am looking at the rp2040 i2c.h file and see a reference to i2c0 and i2c1, see pic. Now I am more sure it's doable but you will have to put on your best sleuthing hat. I did a little more digging and am now very sure it can be done (disable and enable each of the two I2C busses separately). There are numerous references to I2C0 and I2C1 in the second and third

pic.

Screen Shot 2022 09 03 at 10.42.47
Screen Shot 2022 09 03 at 10.51.09
Screen Shot 2022 09 03 at 10.50.24

 

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
(@jasline123)
Eminent Member
Joined: 7 months ago
Posts: 20
 

@zander So i have written a code and used two i2c buses for two cameras(ov2640 with same address 0x30), But this code is giving me errors as

unknown

 So in this I have to disable and enable the two i2c buses, Did I understand it correctly?

import board
import os
import time
import busio
import digitalio
import sdcardio
import storage
import microcontroller
import adafruit_ov2640
from time import sleep
import time
def cameraInit():
    """ Initializing Camera"""
    bus = busio.I2C(board.GP9, board.GP8);
    cam = adafruit_ov2640.OV2640(
        bus,
        data_pins=[
            board.GP14,
            board.GP15,
            board.GP16,
            board.GP17,
            board.GP18,
            board.GP19,
            board.GP20,
            board.GP21,
        ],  
        clock=board.GP5, 
        vsync=board.GP7,  
        href=board.GP27,  
        mclk=board.GP28,  
        shutdown=None,
        reset=board.GP4,
    );
    return cam;
def cameraInit1():
    """ Initializing Camera"""
    bus1 = busio.I2C(board.GP3, board.GP2);
    cam1 = adafruit_ov2640.OV2640(
        bus1,
        data_pins=[
            board.GP14,
            board.GP15,
            board.GP16,
            board.GP17,
            board.GP18,
            board.GP19,
            board.GP20,
            board.GP21,
        ],  
        clock=board.GP5, 
        vsync=board.GP7,  
        href=board.GP27,  
        mclk=board.GP26,  
        shutdown=None,
        reset=board.GP6,
    );
    return cam1;
def sdCardInit():
    """ Initializing and mounting the SD Card """
    MOSI = board.GP11;
    MISO = board.GP12;
    sck = board.GP10;
    cs = board.GP13;
    spi = busio.SPI(sck, MOSI=MOSI, MISO=MISO);
    sd = sdcardio.SDCard(spi, cs);
    vfs = storage.VfsFat(sd);
    storage.mount(vfs, '/sd');
def WriteImageToSDCard(filename,image):
    """ Writing the Image to SD Card """
    try:
        with open(filename, "wb") as f:
            f.write(image);
    except OSError as e:
        print(f"ERROR : While Saving to SD Card {e}");
    print(f"File name : {filename} Wrote to SD Card ");
def main():
    """ Initializing the SD CARD and CAMERA and Writting the Captured Image to SD Card """  
    sdCardInit();
    cam = cameraInit();  
    cam.colorspace = adafruit_ov2640.OV2640_COLOR_JPEG;
    cam.size = adafruit_ov2640.OV2640_SIZE_SVGA;
    buf = bytearray(cam.capture_buffer_size);
    cnt = 1;
    while (cnt <= 5):
        time.sleep(1);
        image = cam.capture(buf);
        print(f"Captured {len(image)} bytes of jpeg data");
        fname = "/sd/image" + str(cnt) + ".jpg";
        WriteImageToSDCard(fname,image);
        cnt = cnt + 1;
        print(f"Wrote to SD Card Having File name : {fname}");
    cam.deinit();
    cam1 = cameraInit1();
    cam1.colorspace = adafruit_ov2640.OV2640_COLOR_JPEG;
    cam1.size = adafruit_ov2640.OV2640_SIZE_SVGA;
    buf1 = bytearray(cam1.capture_buffer_size);
    cnt = 1;
    while (cnt <= 5):
        time.sleep(1);
        image1 = cam1.capture(buf1);
        print(f"Captured {len(image1)} bytes of jpeg data");
        fname1 = "/sd/image" + str(cnt) + ".jpg";
        WriteImageToSDCard(fname1,image1);
        cnt = cnt + 1;
        print(f"Wrote to SD Card Having File name : {fname1}");
if __name__ == "__main__":
    """ Calling Main Program """
    main();

   
ReplyQuote
Ron
 Ron
(@zander)
Illustrious Member
Joined: 2 years ago
Posts: 4455
 

@jasline123 Conceptually it looks like it may be possible to disable and enable the 2 I2C busses independently but you will have to figure out how to do that. It probably means using the pico sdk and C or C++ code. I can't tell you how difficult it will be to find and implement that code, but I was able to quickly find some clues just from a file find of i2c.h at the arduino library level and a google search of 'raspberry pi pico i2c' that led to that github find I told you about and of course the pico datasheet which led to the rp2040 datasheet. I don't see anything usefull in the 2040 datasheet. It is of course assembler and very close to the metal. I am not 2040 trained but have other low level training and can recognize general concepts so I am reasonably sure you do not need that level of code. Good luck.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
(@jasline123)
Eminent Member
Joined: 7 months ago
Posts: 20
 

@zander This has been a huge help. Thanks a lot...I will figure it out.... 🙂 🙂 


   
Ron reacted
ReplyQuote
Page 9 / 11