New MCP221A question

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
doctorwho8
 
Posts: 155
Joined: Sat Aug 01, 2009 10:24 pm

New MCP221A question

Post by doctorwho8 »

Hello!
On the board shown at https://www.adafruit.com/product/4471 I noticed the presence of both a 5v
and a 3v connector. Does this mean that the device will work in both situations? I ask because I'm primarily a user of TTL logic who runs at 5v and rarely do anything with items who use 3v which are usually on the Raspberry Pi systems.

User avatar
sj_remington
 
Posts: 994
Joined: Mon Jul 27, 2020 4:51 pm

Re: New MCP221A question

Post by sj_remington »

The MCP2221A will work with 5V and 3.3V logic. The latter is becoming the standard for MCUs, and is certainly not limited to RPi.

User avatar
doctorwho8
 
Posts: 155
Joined: Sat Aug 01, 2009 10:24 pm

Re: New MCP221A question

Post by doctorwho8 »

sj_remington wrote: Mon Mar 27, 2023 11:20 pm The MCP2221A will work with 5V and 3.3V logic. The latter is becoming the standard for MCUs, and is certainly not limited to RPi.
Hello!
Yes of course regarding other MCUs and probably a raft of regular Microprocessors, I chose the RPi because that fellow was my first exposure to systems running Linux who're making use of levels at 3.3v for example. My next problem will be to work out the Python or Micro Python code to run on the device, or to work with it.

User avatar
doctorwho8
 
Posts: 155
Joined: Sat Aug 01, 2009 10:24 pm

Re: New MCP221A question

Post by doctorwho8 »

doctorwho8 wrote: Mon Mar 27, 2023 11:43 pm
sj_remington wrote: Mon Mar 27, 2023 11:20 pm The MCP2221A will work with 5V and 3.3V logic. The latter is becoming the standard for MCUs, and is certainly not limited to RPi.
Hello!
Yes of course regarding other MCUs and probably a raft of regular Microprocessors, I chose the RPi because that fellow was my first exposure to systems running Linux who're making use of levels at 3.3v for example. My next problem will be to work out the Python or Micro Python code to run on the device, or to work with it.
Hello!
Now this becomes the next one:

Code: Select all

import time
import board
import digitalio
     
led = digitalio.DigitalInOut(board.G0)
led.direction = digitalio.Direction.OUTPUT
     
while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)
Above is the blinky.py code block from the example. It selects the G0 connection as an output. Can that be expanded to include the G1 as well?
It's on that one that I decided to stop there for the moment.

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: New MCP221A question

Post by adafruit_support_carter »

If you want to use G1 instead of G0 then just need to change code to that:

Code: Select all

led = digitalio.DigitalInOut(board.G1)
led.direction = digitalio.Direction.OUTPUT
If you want to use G1 *and* G0, then create two separate variables:

Code: Select all

led1 = digitalio.DigitalInOut(board.G0)
led1.direction = digitalio.Direction.OUTPUT
led2 = digitalio.DigitalInOut(board.G1)
led2.direction = digitalio.Direction.OUTPUT

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”