# Project Idea, could use help - 1m LED independent modules that sync up

**URL:** <https://forum.electromage.com/t/project-idea-could-use-help-1m-led-independent-modules-that-sync-up/2666>\
**Category:** Ideas and Tips\
**Created:** [December 8, 2022, 1:10am UTC](https://forum.electromage.com/t/project-idea-could-use-help-1m-led-independent-modules-that-sync-up/2666 "2022-12-08T01:10:49Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pixie](https://forum.electromage.com/letter_avatar_proxy/v4/letter/p/7bcc69/32.png) [@pixie](https://forum.electromage.com/u/pixie)\
**Post date:** [December 8, 2022, 3:46am UTC](https://forum.electromage.com/t/project-idea-could-use-help-1m-led-independent-modules-that-sync-up/2666/3 "2022-12-08T03:46:45Z")

</div>

If you’re going to have a laptop or whatnot to run Firestorm, you can use the [pixelblaze-client library](https://forum.electromage.com/t/pixelblaze-client-python-library-release-updated-and-upgraded/2566) to broadcast data from one sensor expansion board to the other Pixelblazes with this little program:

> **broadcastSensorData.py**
>
> ```auto
> #!/usr/bin/env python3
> 
> # Import standard library modules.
> import argparse
> from datetime import datetime
> 
> # Import third-party packages.
> from pixelblaze import *
> 
> # ------------------------------------------------
> 
> def timeInMilliseconds():
> td = datetime.now()
> return (td.microsecond + (td.second + td.day * 86400) * 10**6) // 10**3
> 
> # Here's where the action starts.
> if __name__ == " __main__":
> 
> # Parse command line.
> parser = argparse.ArgumentParser()
> parser.add_argument("--fromIpAddress", required=True, help="The IP address of the Pixelblaze to copy expansion board variables FROM")
> parser.add_argument("--toIpAddress", required=True, help="The IP address (or comma-separated list of IP addresses) of the Pixelblaze(s) to copy expansion board variables TO")
> parser.add_argument("--verbose", action='store_true', help="Display debugging output")
> args = parser.parse_args()
> 
> print(args.toIpAddress)
> 
> # Connect to the Pixelblazes.
> print(f"Connecting to source Pixelblaze @ {args.fromIpAddress}...")
> with Pixelblaze(args.fromIpAddress) as src:
> dests = []
> for destIP in args.toIpAddress.split(','):
> print(f"Connecting to destination Pixelblaze @ {destIP}...")
> dests.append(Pixelblaze(destIP))
> 
> print("Mirroring expander board variables; press [Ctrl]-[c] to quit...")
> numSamples = 0
> lastVars = {}
> lastTime = timeInMilliseconds()
> extra = ''
> while True:
> try:
> # Get the exported variables from the source Pixelblaze.
> vars = src.getActiveVariables()
> numSamples += 1
> # Remove any variables not related to the expansion board.
> for key in list(vars.keys()):
> if not key in ['light', 'accelerometer', 'analogInputs', 'frequencyData', 'energyAverage', 'maxFrequency', 'maxFrequencyMagnitude']:
> del vars[key]
> if args.verbose: extra = f": {vars}"
> print(f"Received frame {numSamples}{extra}\r", end='')
> if len(vars) > 0 and lastVars != vars:
> print(f"Sending frame {numSamples}\r", end='')
> for dest in dests:
> dest.setActiveVariables(vars)
> # Back off for a while, since the sensor board only updates every 25 millliseconds.
> thisTime = timeInMilliseconds()
> deltaTime = 25 - (thisTime - lastTime)
> lastTime = thisTime
> if deltaTime > 0: time.sleep(deltaTime / 1000)
> except KeyboardInterrupt:
> print('')
> break
> 
> ```

---

_[View the full topic](https://forum.electromage.com/t/project-idea-could-use-help-1m-led-independent-modules-that-sync-up/2666)._
