So have an Nano here USB powering a 5 LED device that has 3 or 4 additional modes that are supposed to be controlled by the YELLOW wire which I do not have connected. That yellow wire is supposed to be connect to a Radio Control (RC) channel to change the modes, a PWM channel I believe. Can I changed the modes with my Nano? Please help.
See the Servo Sweep example in the IDE.
If we read between the lines, it looks like treating the device as a servo and writing different angles to it might change the modes.
A simple sketch to write angles from 0 to 180 in steps of ten degrees with a two second pause between each step might change the modes, no harm to try.
Use a 220 ohm resistor in the signal line to the "servo".
a7
If you connect the Yelloe wire to a NANO PWM, then if you know how to code the PWM it will be the same. You will need to get that last part form the RC transmitter documentation.
UKHeliBob Do you have any input on this? I am sure you have seen this question multiple times. I respect your reply and opinion...
" Typically, a servo motor anticipates an update every 20 ms with a pulse between 1 ms and 2 ms. This equates to a duty cycle of 5% to 10% at 50 Hz. Now, if the pulse is at 1.5 ms, the servo motor will be at 90-degrees, at 1 ms, 0-degrees, and at 2 ms, 180 degrees."
@misterbee1 - that's a standard servo signal and the Servo library can produce it directly on an output pin of your choice.
See the Servo Sweep example in the IDE.
https://docs.arduino.cc/libraries/servo/
Or do you need someone to write the code for you?
Once you know the angles that the device needs for each mode, expand the sketch to read a button or buttons or whatever, and in response write the angle you have determined is appropriate ("select a mode", or "next mode/previous mode", whatever).
Do you have a link to the device you are trying to control?
a7
Are you not happy with the replies that you got till you posted that?
Which RC?
I am happy with ALL of your replies. Thank you.
Any. It has to be a simple fix. Who can help me? How do I get Arduino to mimic a 3rd channel PWM output of an RC controller to get my LED device to change modes?
OMG are you being deliberately obtuse?
It's a servo. Get out the Servo Sweep example and see if you can send various angles to the device and get at its different modes.
If you tried that, post the cod you tried and say what happened. If you haven't yet, stop wasting time and just try it.
a7
I will try it. Thank you.
Servo Sweep worked! It goes through the 4 modes and then turns off and repeats. Check it out:
So, I guess all I have to do is put the momentary switch on pin 9 and I am set? Or do I have to speed that delay up?
Yay! Forgive me if I am not surprised.
My choice would be to use the sketch logic to write the correct value for a mode when it was time to switch modes.
Which is why I may have suggested working out what the angles are for each mode.
Then in the code you want to use with this, keep a table of those magic values, and servo over to the appropriate one.
I don't know what you mean by
It sounds hit or miss, inconvenient and tricky to use, giving your words te only interpretation that makes sense.
If it is exactly the servo sweep example from the IDE you are using, say. If not, post the code you are using.
Do you have a 10K potentiometer laying around somewhere? We could guess at the values... how many modes are there?
Did you ever post a link to the exact device you have in front of you? I found a few that operate in the same manner, but for the next level of use more info would not hurt.
How do you intend to use this in what project? I would bury all the details in a function that would switch to mode N (supplied as an argument) when called.
a7
What I mean by momentary switch on pin 9 is that I guess this is where I would put momentary tactile switch to change through the 4 modes of blinking of the device.
-
To answer your first question, yes I am using the exact code from the servo sweep IDE example.
-
Yes I do have potentiometers laying around...not sure if 10k.....
-
There are 4 modes for my LED device
-
Exact link for my LED offers no help, just a price and that it is to be plugged into a third channel of a RC controller. Which I am not using for my project. So n/a
-
How do i want use this? Just hook it up to power and control pin and press button to change through the 4 modes of blinking.
Look forward to your reply. Thank you
Found a 10k POT just tell me what to do with it to check those values please:
alto777 can you help me? I have a pot and want to connect it to figure out the angles for modes. Please let me know.
I can't write the sketch for you now. Can you make sense of this I found googling?
All you need to do to get the magic numbers is or t the value of pos in the code that you will find there.
You might google
arduino potentiometer control servo
to see other explanations, they'll all have about the same simlpe code.
a7
Ok I think I got it and what do to do, I will report back in a bit or by tomorrow. Thank you for replying.
Hi Alto, my 10k pot is hooked up and my "servo" is connected:
I just need to run a code to read the values of the pot connected. So what code should I run, I've seen a few...
Look through the link in #21.
There's exactly code except it does not print the value of the potentiometer.
Add printing to it.
a7