However it struck me that I could use the adalight approach to give LED readouts on the in game HUD. (in the video, for instance, you can see the yellow and red bars either side of the map move up and down, I thought it'd be cool to have an actual bank of LED's turn on and off.

So what I want to do is hack the adalight processing code, assign my own screen locations for sampling for each LED and then output that to the arduino using the existing serial comms.

Easy !! :D

err well maybe not... :cry:

I've been fiddling with the adalight processing code and going round in circles a bit. :? :shock:

I'm not sure what the best bit of code to fiddle with would achieve this best ? Anyone got any hints? Am I better off writing something from scratch ? in which case any hints on how to get a single LED to light from a single sampling point?

Thanks in advance for any help.

T

ps apologies if this is in the wrong forum section.. just occurred to me that it might belong somewhere else as although it's a project with an arduino in it I don't need help with the arduino bit.

If you could manually assign the areas then I guess you could always manually assign the sampling points for the ambient effects?

You could always use another adalight rig for the ambient lights? (I've got 3 :-) ) and I'm trying to get the pi based adalight system featured in the blog working anyway (which would take over ambient effects).

I have tried using light pack, which allows you to choose where the sampling points are but it enforces a minimum sampling area which is too large.

I've written a script in Autoit that creates a Gui window and then sets it's background colour to the colour of the weapon status indicators.

This gui window sits on my second window and then the adalight script is configured to scan that.

et voila - the gui changes colour with the game - the adalight scans the gui - the arduino sets the led colour. Now I'm fully aware that the coding-cognoscenti amoungst you have now devloped the sort of twitch normally caused by someone dragging their fingers down a blackboard. This is a kludge, I know. But I wanted to see what it was like in principle. It's a horrible cpu hog and has wiped 25% of my frame rate off the game.

It's thrown something up already - the background of the indicators in game is semi transparent. I think I'll have to think long term about somesort of filtering on the values "what's the colour, is is mostly green? then send green"

So While I'm waiting for Phil's return to help with integrating this with adalight proper I'm attempting a different approach. (and so people don't just think I'm sat here just flapping)

So...

What I'm going to try and do it based on the colour of a particular part of the screen - send a preset colour command to the rgb string on the arduino.

So far I've gotten a piece of code on the arduino that sets the colour of the leds to Red green or blue based on the incoming serial stream. and a piece of processing code that sends R or B over serial when I click a mouse button - and - well it kinda works!

I have flashing green and blue lights - not proper control yet. I think I need some sort of end bit output stream from processing.

That's more an issue of transmission protocols than hardware, so you have plenty of room to experiment. There are lots of existing protocols with various amounts of reliability and error recovery.

For the short term, try doing a simple loopback test. Send some information from Processing to your Arduino, then have the Arduino send it back. It's been a while since I worked with Processing, but I recall issues where the serial buffer needed to be flushed every once in a while.

When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.