Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpPrograms › sending multi-byte numbers into wiring

Page Index Toggle Pages: 1
sending multi-byte numbers into wiring (Read 2967 times)
04/28/08 at 13:56:41

roypardi   Offline
Junior Member
I Love YaBB 2!
Boston USA

Posts: 57
**
 
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
 
IP Logged
 
Reply #1 - 04/29/08 at 05:34:34

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
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.
 
IP Logged
 
Page Index Toggle Pages: 1