View Single Post
Old 04-16-2014, 03:14 PM   #29 (permalink)
P-hack
Master EcoModder
 
P-hack's Avatar
 
Join Date: Oct 2012
Location: USA
Posts: 1,408

awesomer - '04 Toyota prius
Thanks: 102
Thanked 252 Times in 204 Posts
Time is analog

Reducing it to a 1 or a zero is the best way to eliminate rounding errors. The concept is as old as morse code, and serial communication is as old as two comupters talking to each other digitally. uart only uses it enough to determine if it is looking at a 1 or a zero, that is the basis of digital.

There is a lot of goofiness in the arduino implementation itself

you start with an analogread of 10 bits

you write it with analogwrite which drops it to 8 (resolution is now 1/4 the original)

you use pulsein to read it, which has a host of issues on the arduino.
Lets just say it isn't accurate, nor excellent for devices that can communicate digitally, easily.

And the boards themselves will have slightly different oscillator frequencies.
I2c builds on serial communication by adding another wire, a clock signal, to keep communication in synch.

Softwareserial makes it easy to use any pins, you write to it and read the responses from it, and you don't lose anything of the original voltage reading (the whole reason for doing this).

Last edited by P-hack; 04-16-2014 at 03:21 PM..
  Reply With Quote