Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Programming Questions & Help >> Programs >> sending multi-byte numbers into wiring
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1209391001

Message started by roypardi on 04/28/08 at 13:56:41

Title: sending multi-byte numbers into wiring
Post by roypardi on 04/28/08 at 13:56:41
Have spent more time on this simple task than I care to admit...

I have wiring hooked up to an H-bridge motor controller with an attached encoder. I want to be able to send numbers in to have the motor seek to that position. The range is roughly between -30000 to 30000.

I'm trying to rebuild the number on the wiring side from the bytes sent - and am sending a control char ('*') to single the end of the number. I don't have any issues using Serial.read() to get the bytes but I am having trouble rebuilding a valid number that reflects what was sent in.

Anyone have some boiler plate code for rebuilding integers?

--Roy

Title: Re: sending multi-byte numbers into wiring
Post by barragan on 04/29/08 at 05:34:34
hi Roy, I think this example might help you: http://wiring.org.co/learning/examples/usb_weather.html
The Wiring hardware receives through Serial1 data from a sparkfun usb weather board, the date comes as a string with values, the values are parsed as integers and then used.

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.