<div dir="ltr"><div><div>You're trying to send both numbers and text as bytes (Serial.write transfers bytes to the serial port). Your sketch checks whether the value read from the sensor is within range and if not, it warns you with text, but to receive text you need to use Serial.print which transfers ASCII values. Then you'll have to assemble that text in Pd (I guess with [makefilename] or something, but have never tried it).<br></div>If you wanna use Serial.write (which I think is the way to go), you shouldn't send text, but only values. I've written two versions of your sketch, one checks if the distance value is within range, and if not, it zeros that value, else leaves it intact and writes it to the serial port. The other version splits the byte to two, in case the value exceeds 255 (no idea what that range is), as Serial.write transfers bytes and if you get a value higher than 255 (a full byte), Serial.write won't be able to transfer that and your value will wrap back to zero.<br><br></div>Also, you were trying to use a custom Arduino sketch with Pduino, which works only with Firmata. I've changed the Pd patch as well (for both versions). Check it out and let me know if it works.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 11:29 AM, Sujay Mukherjee <span dir="ltr"><<a href="mailto:mukherjee.sujay@gmail.com" target="_blank">mukherjee.sujay@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div> Hi<br>I had been trying get distances as numbers from a ultrasound distance sensor HC_SRO4 from the echo pin .<br><div>while
 trying to do that i am getting an error message in the console window 
and the number input attached to the echo pin through the route object 
is  remaining plum at zero<br></div><div>the error message that i am getting in the console window is as follows:<br>UNKNOWN_INPUT_COMMAND: 0 28672<br>UNKNOWN_INPUT_COMMAND: 0 28672<br>UNKNOWN_INPUT_COMMAND: 0 28672<br>UNKNOWN_INPUT_COMMAND: 0 224<br>UNKNOWN_INPUT_COMMAND: 0 224<br>UNKNOWN_INPUT_COMMAND: 0 28672<br>UNKNOWN_INPUT_COMMAND: 0 28672<br>UNKNOWN_INPUT_COMMAND: 0 224<br>UNKNOWN_INPUT_COMMAND: 0 28672<br>UNKNOWN_INPUT_COMMAND: 0 224<br>UNKNOWN_INPUT_COMMAND: 0 224<br>UNKNOWN_INPUT_COMMAND: 0 224<br></div><div> please suggest how to get distances through the pd patch<br></div>I am attaching the sketches <br></div><div>please tell me whr i am getting wrong and what i need to change in the pduino patch to get a number inputs<br></div><div><br></div>thanks <br></div><span class="HOEnZb"><font color="#888888">Sujay<br></font></span></div>
<br>_______________________________________________<br>
<a href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -> <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
<br></blockquote></div><br></div>