Page 1 of 1

Arduino All Effects with IR support

Arduino All Effects with IR support

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
Examples: "MacOS X - Your question", "MS Word - Your Tip or Trick".

Please note that switching to another language when reading a post will not work!
Posts will not have a translated counterpart.




RSS Feed

Home Forums Hardware Arduino Arduino All Effects with IR support

This topic contains 3 replies, has 2 voices, and was last updated by  hans 2 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • 11480

    dai trying
    Participant

    I have been working on a solution to get the all-in-one sketch to work using an IR remote, this has proved to be very problematic in getting correct readings from the remote and implementing it in the sketch.

    I ended up re-writing almost the entire sketch to prevent the use of delay() which was part (but not all) of the problem. The only way I have found to implement it was to use two (2) arduinos connected by serial communication, the first arduino simply catches the IR signal and interprets it and then sends the appropriate signal to the second arduino. The second arduino contains the (re-written) All-In-One sketch which reacts immediately to the command and sets the effect accordingly.

    One thing I should say before finalising this post, (1) when programming either arduino you should disconnect the rx/tx pins, I have read it will not work correctly with them connected and it could conceivably cause damage so please remember this when uploading code.

    Connections are made as follows:-

    Arduino1 pin rx -> Arduino2 pin tx
    Arduino1 pin tx -> Arduino2 pin rx
    Arduino1 pin 6 -> IR signal
    Arduino2 pin 6 -> LED strip signal

    As well as the required power pins, and remember to use common ground where applicable.

    Two sketches are attached and it is very likely that further adjustments will need to be made but I was so relieved to have finally managed it I wanted to post immediately. Any comments/improvements always welcome.

    Attachments:
    11484

    hans
    Keymaster

    Hi Dai!

    Great to hear you found a way to get this to work – and thank you very much for posting your code 

    The second Arduino is almost unavoidable since catching the IR codes does not trigger an interrupt. More advanced interrupt code may be able to catch it, but it’s trick. An Arduino in the end is not build for “real” multitasking …

    11486

    dai trying
    Participant

    Yes, I tried many tricks to attempt to make it work but in the end this was the only way I could get it to work with immediate change. Some of the code might be a bit coarse and I’m certain it can be improved upon, but that is for another day, I forgot to mention I have not yet coded the functions for Fire and BouncingColoredBalls as they seemed more complex but I will see if they can be written without the delay() function at some time.

    I do think using two arduino’s that cost around £1.30 (GBP) each is a very cheap fix.

    11488

    hans
    Keymaster

    You’re absolutely right; Arduino’s can be had real cheap – isn’t that the beauty of it? 

Viewing 4 posts - 1 through 4 (of 4 total)



You must be logged in to reply to this topic.