New Trinket Library!

Forum announcements

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
PyroAVR
 
Posts: 27
Joined: Sun Sep 02, 2012 6:11 pm

New Trinket Library!

Post by PyroAVR »

Hello All,
I thought that I would announce a library which I have ported to work with the Adafruit Trinket. I ported the Wii Nunchuck Library to work with the Trinket, and all of the functions except for the debug-over-serial work without any issues. I have removed any functions which do not work in the library to eliminate any confusions. Also, I have completed the code which was originally posted at the Arduino Forums to support syntax highlighting in the Arduino IDE and have included a demo sketch along with the library to make sure your controller is working. The hookup instructions are different, so I have also included those at the top of the demo sketch.

You can download it from my Github, located at: http://www.github.com/PyroAVR/TrinketNunchuck

Note that it requires TinyWireM to be installed in your Arduino library path as well.

I hope that someone can make use of this!

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: New Trinket Library!

Post by adafruit_support_mike »

Nice! Thank you.

User avatar
frank26080115
 
Posts: 126
Joined: Fri Jun 15, 2007 1:04 am

Re: New Trinket Library!

Post by frank26080115 »

cool stuff

If you restructure your code a bit, you can also work with the Wiimote Classic Controller. You can also read back data from the Wiimote's infrared camera

TWI is a synchronous bus, I think you might benefit from using a software bit bang implementation of TWI instead of one that uses the USI, this will free up the USI to do other things. Just food for thought. Go to Atmel's site and search for "Atmel AVR156: TWI Master Bit Bang Driver" to learn more.

I might end up writing a TinyWireM replacement using AVR156 but it's not high on my priorities list

User avatar
DisruptItYourself
 
Posts: 193
Joined: Mon Sep 23, 2013 6:58 pm

Re: New Trinket Library!

Post by DisruptItYourself »

Hey we should brainstorm and work together on a project. I would love to use a classic controller over usb!

User avatar
frank26080115
 
Posts: 126
Joined: Fri Jun 15, 2007 1:04 am

Re: New Trinket Library!

Post by frank26080115 »

indiwerwlf wrote:Hey we should brainstorm and work together on a project. I would love to use a classic controller over usb!
I've already done that, also done that with PS2 controllers, stuff like that takes me 30 minutes now. I can probably turn my old code into Trinket friendly code... not high on my priorities list though.

Meanwhile, check out http://wiibrew.org/wiki/Wiimote/Extensi ... Controller for data format and identifier information

User avatar
DisruptItYourself
 
Posts: 193
Joined: Mon Sep 23, 2013 6:58 pm

Re: New Trinket Library!

Post by DisruptItYourself »

But think how cool it would be to cut the classic controllers cable, wire everything up with a trinket inside the classic controller and leave the mini USB poking out. Is there enough room in there for an arduino mico at least? Then I wouldn't really have to do much to the code...

User avatar
frank26080115
 
Posts: 126
Joined: Fri Jun 15, 2007 1:04 am

Re: New Trinket Library!

Post by frank26080115 »

indiwerwlf wrote:But think how cool it would be to cut the classic controllers cable, wire everything up with a trinket inside the classic controller and leave the mini USB poking out. Is there enough room in there for an arduino mico at least? Then I wouldn't really have to do much to the code...
Trinket 3.3 is probably the best choice in terms of size, the next smallest option is probably Teensy (but make sure you install the 3.3V mod for it)

Arduino Micro is the same chip as the Teensy but almost twice as large

PyroAVR
 
Posts: 27
Joined: Sun Sep 02, 2012 6:11 pm

Re: New Trinket Library!

Post by PyroAVR »

indiwerwlf wrote:Hey we should brainstorm and work together on a project. I would love to use a classic controller over usb!
I'm working on that one, hold on!

PyroAVR
 
Posts: 27
Joined: Sun Sep 02, 2012 6:11 pm

Re: New Trinket Library!

Post by PyroAVR »

indiwerwlf wrote:But think how cool it would be to cut the classic controllers cable, wire everything up with a trinket inside the classic controller and leave the mini USB poking out. Is there enough room in there for an arduino mico at least? Then I wouldn't really have to do much to the code...
That too, for that matter...

PyroAVR
 
Posts: 27
Joined: Sun Sep 02, 2012 6:11 pm

Re: New Trinket Library!

Post by PyroAVR »

frank26080115 wrote:cool stuff

If you restructure your code a bit, you can also work with the Wiimote Classic Controller. You can also read back data from the Wiimote's infrared camera

TWI is a synchronous bus, I think you might benefit from using a software bit bang implementation of TWI instead of one that uses the USI, this will free up the USI to do other things. Just food for thought. Go to Atmel's site and search for "Atmel AVR156: TWI Master Bit Bang Driver" to learn more.

I might end up writing a TinyWireM replacement using AVR156 but it's not high on my priorities list
I'm still learning how to bit-bang serial buses. When I figure it out, I'll definitely give that a shot. Right now I'm making an FPV helmet with the BBB and reading data from the WiiMote would make an interesting control scheme. I'll port it back to Trinket when I finish, perhaps...

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

Return to “Announcements”