Open TaterTot24 opened 1 year ago
Pin 1 on the 5V trinket is an onboard LED. https://www.adafruit.com/product/1501 You might be able to find them on DigiKey.
If you can only find the Pro Trinket version, then you can just use pin 13 instead of 1
So I am using the Trinket Pro 5V and I am getting an error with LINE 39 with "TIMSK" (."Compilation error: 'TIMSK' was not declared in this scope"). Apparently there is something different about the Trinket vs the Trinket Pro. I tried changing it to "TIMSK0" because I saw something on the SoftServo page about it. It will now compile, but I cannot get my motor to move (during STAGED or when RACING). I can watch the LED and know that it is reading the IR correctly , but I get nothing from the motor. Any suggestions in troubleshooting would be appreciated. It may have something to do with the difference between TIMSK & TIMSK0
Trinket Pro is a Atmega328P chip while the Trinket is a Attiny85 - different processors. I think you are correct that in the mega/uno is the TIMSK0 interrupt. The signal interrupt is the same. Check your wiring is correct and you have continuity and your ubec is getting power. Validate your IR break beam and output pins are correct in the code. I had to program my UBEC before my engine was set correctly -- if you haven't done that yet -- it may be your challenge. NegativeC has code for that as well if you don't have a programming card
And make sure you have the darn thing secured with a clamp or something when you are trying to get the code and circuit to work... I had my 70mm jetcar launch when I was messing with it twice, until I built a harness to keep it from orbiting my workshop. and please remember to shut off the engine early when testing... I'd go 1100 milliseconds until you have it tested on a track... mine was faster than 1500 milliseconds and you don't want it to continue to thrust past the finish line... these things are crazy missiles.
from the product description it seems like the IR input will have to be moved from pin 2 to pin 3 or something else. Pins #2 and #7 are not available (they are exclusively for USB) I think pin 0 is still okay for the ESC
I am looking at programing the ESC now (using NegativeC's other code). I am using Pin 3 for the ESC and Pin 5 for the IR (and Pin 13 for the LED as suggested earlier). Hopefully that is the issue. I will report back on what I find. Thanks guys!
So I found the problem. Apparently the Trinket Pro takes a couple of seconds to "boot up" (around 2-3 seconds for the LED to stop flashing) and powering the Trinket Pro from the ESC is an issue, because it expects a usable "SERVO/THROTTLE" signal immediately (at lease my ESC does). When my ESC doesn't immediately see a signal, then it goes into some sort of protect mode. The way I figured this out is I had the Trinket Pro running off of USB power and once it "Boots Up", then I connect the LiPo and everything works like a champ. Anyone have any suggestions on how to make this work? Does the regular Trinket really boot that much faster? Do I need to try to find a regular Trinket?
yeah, it seems to be the bootloader on the Pro. It waits for 10 seconds before running the code which gives you a chance to upload a new program. the code for that is here: https://github.com/adafruit/Adafruit_ProTrinket_Bootloader In main.c you could change the timeout from 10 to 1 but not sure it that will have undesired results. Adafruit has bootloader update instructions. I wonder if you can just disable it entirely when there is no USB connection??
It might be best to buy a regular trinket (digikey) or maybe get a 5v regulator and boot it first before powering on the ESC
Your idea and code are awesome . I am planning on doing very similar based on the information that you have here. However, the code references an LED on Pin#1, but It is not on the wiring diagram or referenced in the parts list or project overview. I didn't even see it in the pictures of the car either. I'm assuming from the code is to let you know whether or not the car is "armed" or not. Can you provide any more details?