Adafruit Trinket Software Serial
I have a couple adafruit trinkets i purchased. And I got a hold of a JY-MCU bluetooth adapter. Using my UNO I have been able to get this bluetooth working with software serial so I can talk to my microcontroller over bluetooth.So in an effort to go miniature I wanted to put that sketch on the adafruit trinket. But the code is too big!!I am sure its in the softwareserial.h since that is 4k by itself.So I am curious, what is the best way to work with the trinkets? Or should I be looking at something like the arduino mini that has 32k flash?
Since the trinket only has 6k?I am pretty new to this, but have been spending HOURS each day getting up to speed. So I am curious how others are working with the tiny devices. (Tiny Core 2, Stripped down libraries, ect).
Adafruit Trinket Driver
Thats quite a lot, I've tested out a hc-06 bluetooth module, where everything is set up on that, which I found cheap on eBay, so not sure if that could help making your code smaller.I don't know if this is possible, but it would be interesting to see if you could remove or reduce some softwareserial.h code and just keep the ones your personally utilising.Or is there a hardware UART you can use to send data too? Then I don't think you need to import anything which would definitely reduce your code as well? Of course it's easiest to just throw money at the problem.Just buy a controller with more flash.Or. Find out exactly what' s making your code big and fix it.It's a great little puzzle. With some optimization, I'm sure getting BT to work on a Trinket in 6k or less is absolutely no problem.Not sure where it's located on Windows/iOS, but 'avr-size' is your friend.You'll have to decide for yourself if you're more the puzzling kind or the throw money at the problem kind.Both are valid approaches. The 'best way' to work with the Trinket, IMO, is to either use the Digispark bootloader (same V-USB configuration) and get back a bit of flash too since the Digispark bootloader is smaller. Or, simply do not use the bootloader at all.
Or, as I did move to a DIP configuration for development and then on to the real device for the project. The Trinket is extremely simple to buildout on breadboard of stripboard:The other nice thing about the Digispark is that their libraries work unchanged on the Trinket. So you can have Keyboard and Mouse HID, etc. Personally, I like the Trinket hardware and the Digispark software. And with opensource, you can have 'em both.You will definitely want to check out Nick's send-only version of SoftwareSerial.Ray. Well, it was I who made the Trinket forum knowledgable of Nick's one-way library. And I had a good play with the toys.Bloat is a relative term, especially on the Attiny85/b.
Adafruit Trinket Software Serial Key
Here is the actual overhead numbers for use of SoftwareSerial.h in a send-only Trinket example published as part of the referenced Bluetooth article.Readers, you can make your own determination. (1.5.6r2)Empty setup and loop // minimum sketch. 444 flash bytes. 9 Bytes SRAMSend CR to SoftwareSerial object // minimum use. 2,662 flash bytes used. 123 Bytes SRAM.