2 Replies Latest reply on Oct 26, 2015 2:33 AM by Taimoor

    Send data to Mac


      Hello. Sorry for the basic question, but what is the easiest way to stream data from the Edison (i.e. real-time sensor values or analogIn values) to a Mac, using Python? EDIT: I would need to be able to access this sent data in either Matlab or Python running on a Mac


      I want to perform mathematical operations on sensor data but on my Mac and not on the Edison (for several reasons).



        • 1. Re: Send data to Mac

          Hello menonv,


          You may be able to do it by sending serial data throught the Edison's Serial0 port (the one used for the Arduino IDE) which is directly connected to the micro-USB port next to the micro-switch. You can do this by making system calls that send data to ttyGS0. On your computer's side you will have to read this data from the serial port in order to use it as you wish. Here's a quick example on how to send data to Serial0:


          from subprocess import call
          import time
          while True:
                  call('echo Your_Message > /dev/ttyGS0', shell=True)
                  call('echo Another_Message > /dev/ttyGS0', shell=True)



          • 2. Re: Send data to Mac

            If you want to avoid cabling, and use the Wifi network, consider MQTT. Just host a mosquitto broker on your MAC, and run a subscriber.


            You can publish data from the Edison. Here is an untested snippet... This is basically how it works...

            import paho.mqtt.client as mqtt
            import time
            def on_connect(client, userdata, flags, rc):
                print("Connected with result code "+str(rc))
                print("Connected to " + BROKER_ADDR) # BROKER is your MAC
            def main():
                while True:
                    client.publish("edison/test", "Hello Edison!!")