I have the temperature coming from my arduino through the serial port on my mac. I need to write the data to a file, i don't want my script to write the data from /dev/tty.usbserial-A5025XZE (serial port) if the data is the same or if it is nothing. The temperature is the the format "12.32" and is sent every 5s.
Just save the output from the arduino to a temporary variable and compare it to another that is the last value written to a file. If it is different, change the last value written to the new temperature and write it to the file.
Check to see if data is the same before writing over it