Number up to 180 from C# serial print mapped to servo movement
January 14, 2012
Okay, I'm thinking the title probably isn't very descriptive but it's late and it's the best I can do. Basically, I've written a program in C# (I shall unveil this on here in a few days) that ouputs a value between 0 and 180 based on certain conditions. I want to be able to take this value and print it over the serial and read it at the Arduino end as an integer, so i can just have myServo.write(int).
At the moment, in C# I'm using sp.Write(int.ToString()); but I can use the same command to write a byte array and a char array.
Based on this, first of all, what's the bend form to send it through the serial in? Second of all, how do I pick that up at the other end and make it back into an integer? I'm fairly new to the Arduino side of this so sorry for no copies of my attempts at my own Arduino code..!