Can you use the flashlight with V5 brains? If so, how?

I’m very new to programming, so I’m sorry if some of this doesn’t make sense or sounds silly!

I’m working on a project and I wanted to use a VEX flashlight like the one here and it seems like it was intended to be used with the vex microcontroller instead. I’ve been looking, but I can’t seem to find any instructions online that explain how to use the flashlight with the V5 brain.

Can the flashlight even be used with a V5 brain? If it can, how would I do that? What port would I put the flashlight into? What device would I select for it in VEXCode Pro V5? How would I program it?

Welcome to the forum @goforbroke!

Does this other thread help answer your question?

3 Likes

Thanks for replying! I saw that thread, which helped me to realize that I should be using a motor controller. But from there, when I’m adding a device under the Robot Configuration tab in VEXCode, what do I choose? How do I go about programming the flashlight using pwm_out? I need an explanation that’s a little more in-depth.

Do you want to post your code? It is hard to debug without the program.

The closest thing I have to code right now is this, which I found on this thread. :

vex::pwm_out Flashlight = vex::pwm_out(Brain.ThreeWirePort.B);

// set pwm output for the Flashlight
Flashlight.state(100, vex::percentUnits::pct);

I replaced B with the correct port that the flashlight is plugged into. I’m not exactly sure where that first line fits into my code. Should some of it go before the initialization?

You can only invoke Brain.ThreeWirePort after Brain initialization. Take a look at this topic:

2 Likes