I have been reading that C# is more or less a like C but with enhancements.
Coming from C, i used printf quite a bit.
So i am seeing that i have to use the SerialPort object.
What is blowing my mind is how can C# be better when before in C and wanted to print say “Hello World” all i had to do was
Every language has its advantages and disadvantages. C# is not C.
There are many good books on that.
If you ever look at the code for printf, you’ll see all the stuff that happens there.
You may want to change the way you do things. As a rough example, make an object to handle the “small” stuff behind the scenes.
class DbgPrint
{
static SerialPort UART = new SerialPort("COM1", 115200);
public static void init()
{
// Open UART before printing
UART.Open();
}
public static void myPrint(string myString)
{
// convert the string to bytes
byte[] myBuff = Encoding.UTF8.GetBytes(myString + "\r\n");
// send the bytes on the serial port
UART.Write(myBuff, 0, myBuff.Length);
}
. . .
}
Then just call the procedures from your other code, i.e.
OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
// Open COM1 as debugging terminal
DbgPrint.init();
.
.
DbgPrint.myPrint("Start LCD_Init");
So then how do you guys get that result ?
Say i want to print something like temp on an LCD.
temp = 123.45
when the temp goes down to “1.23” i want the lcd to show “001.23”
are you telling me that i have to create code to watch for the length and have a routine to add the “0”'s in place ?
If this is the case, that sounds very lame at best. Why would C# drop the wonderful and powerful options of printf.
Doesn’t really matter. VS will copy them to your bin directory during compile. Personally, I keep a folder called “3rd Party Components” to keep all this stuff in.
let me ask you guys this.
I have been looking here http://msdn.microsoft.com/en-US/library/67ef8sbd(v=VS.80).aspx
but its clear to me that this is not where i should be at for learning the micro framework.
Yet i cannot find a page like this for micro framework.
The reason i ask is when i was looking here; for string formatting it shows how to use it yet the MF does not have it. So what gives ?
Where can i find information like these links that just deal with the MF, so know what i have available to me to use, and not try to use something that is not available to me.