USB Host Shield GPIO, is an Arduino library, that allows you to easily access the GPIO pins of the Max 3421 IC present in the USB Host Shield.
Features
This library allows both read and write operations on the GPIO pins of the Max 3421 IC. Each pin can be read or written separately like the digitalWrite
or digitalRead
.
Also note that only digital write and read are supported, since the IC doesn’t support PWM.
Setup
Stack the USB Host shield on top of Arduino. After that connect the GIn or GOut pins of the shield to your circuit as needed.
Usage
To use the library, you have to include the MaxGPIO.h
header file. After including the header file, create an instance of the MaxGPIO
class. You can call the write()
or read()
method on that object that you have created. These functions are similar to the digitalWrite()
and digitalRead()
functions which is present in the core.
I have included an example sketch inside the examples
folder that explains how you can access the library.
Video
I have also uploaded a video, which shows how you can use this library to access the GPIO pins. In the video, I have added 8 LED’s to the 8 GOut pins and I control each of them separately.
Download
You can download the library from its github page. The examples are there inside the /examples folder. After downloading place the USB_Host_Shield_GPIO folder inside your Arduino’s /library folder.
Dependency
This library requires the USB Host Shield library, without which this can’t work.
License
The library and the examples are released under released under BeerWare license.
I would, however, consider it a great courtesy if you could email me and tell me about your project and how this code was used, just for my own continued personal gratification.
Stay updated
If you want to be informed when new version of this library is released, then subscribe to this blog’s RSS feed or follow @hardwarefun in twitter.
History
- 2012-10-29 β v0.1 β Initial version
well done.
In gitgub page, there is one Make file and c file.
Where exactly is the library?
I am new to Arduino . I want to move totally into Atmel from PIC.
If you make a blog post on “How to create a library”, that will be very helpful.
Nandri,
PS: so, you lied that you hack on sundays in mail list. You are hacking on weekdays too , isn’t it? π
The USB_Host_Shield_GPIO.{h.cpp} files in the root of the githuh repo is the actual library. The files in the example folder shows you how you can call the library.
To install the library, you have to copy all the files in the repo to a folder called USB_Host_Shield_GPIO and place it inside the library folder of your Arduino installation. Once you do that, you will be able to open the examples from file->examples in the IDE.
Will write a detailed post about libraries soon.
I didn’t lie in the mailing list. I just said I hack on weekends. That doesn’t mean that I don’t hack on weekdays as well π In general I hack and play around with stuff, whenever I get a chance or free time π
Hi, i’ve this error:
arduino-1.0.3librariesUSBHostShieldGPIO/USB_Host_Shield_GPIO.h:32: error: ‘rIOPINS1’ was not declared in this scope
How i resolve this?
Do you also have the USB Host Shield library as well?
Yes, from circuit@home
There was an include missing in the example file. I have updated and pushed the changes to github.
Kindly take the latest version and you should not face this issue.
This last version solve the error.
The example is working
thx
Nice to know that this solved your issue.
Do let me know if you manage to do something interesting with this library.
Hi seem to be having some trouble with the max.read function. If I read all 8 pins which are conected to buttons, half read low and half high, always.
Is there an error in the library?
The max.write is fine.