Hi,
My name is Ray... Live in upper state NY..
Been a Dronebot youtube viewer for a while now...
I am retired now... worked in computer maintenance/install for
about 42 years... I enjoy writing simple web pages.. html/css/javascript
using a simple text editor... actually a vi emulator for windows. 🙂
Recently I started playing with Arduino... specifically the pro-mini...
(Inland version- purchased from Micro Center - was on sale 4.99)
Using Amazon... bought some stepper motors/servos/IR sensors...
created a sketch to use an old TV remote to control a stepper motor.
While testing the remote i noticed that for some keys a quick tap of some
of the keys sent the code 3 times while other function would send the
code once followed by 2 (FFFFFFFF) codes.
To insure I wouldn't get one key tap being misinterpreted multiple commands
I implemented code to only read the first code input and ignore others...
and to prevent me from entering bad commands by hitting a key...
that didn't register and then a second key which did... throwing things off.
I wrote it so that every command requires 2 keys...
tapping '0' puts it in command mode and the LED on the arduino lights...
The next key is the actual command... tapping the action key performs
the action and turns off the LED.
Works fine... I have other dreams(uses) for this... we'll see... LOL
RayB...
Welcome to the forum!
You may know this already, but just in case, the 'FFFFFFFF' from the remote was just a 'repeat' signal. The longer you hold any key down on the remote, the longer the sequence of 'repeat' characters you will get.
And even if you did know this it might be good information for others reading this post that haven't delved into IR remotes yet.
I'm currently enjoying Paul McWhorter's series of lessons on the Elegoo Smart Car and have come to realize the limitations of trying to control a moving object like a robot car using IR. Bluetooth is coming up in soon to be released lessons, so the limitations we've encountered with IR should be overcome.
If you haven't stumbled upon Paul's YouTube videos, they are definitely worth taking a look. And Bill's DroneBotWorkshop is one of Paul's favorite YouTube sites. Paul has given Bill a shout out on several occasions.
Enjoy!
SteveG
@codecage
Hi,
I used Dronebotworkshop youtube videos for reference...
This particular remote (Sony RM-V310) will send the F's even with a
very brief tap of the key ... but only certain keys...
Used the IR capture sketch to sample key codes....
I also found that some keys randomly gave a different number...
Example: key for the number 7... would give a code of 610 but
occasionally I would get a 31581905 (always the same alternate number).
I experienced this with the 1, 8, 9. and Enter key each having it's own
unique alternate 8 digit number.
Example...pressing the 7 key would produce 31581905 , 610, 610.
Using an array of valid codes I check for a match.
The above example would register a 7 correctly since the first code would
be ignored.
One helpful hint I would like to pass on
is about the use of the switch
statement... Took me a while to find this...
So maybe it will be useful posting here.
Lets say that I have a routine
that covers keys 7,8, and 9
I could have separate case statements
for 7, 8 and 9 pointing to a common subroutine.
Or I could use just one statement
"case 7 ... 9:" followed by the required code.
Took me a while to find that I could use a
range of values in a case statement.
(this is actually what I used for these keys)
Great! Glad you found the switch statement. It can really come in handy.
SteveG