How to do in pbasic what works in C ????
ErikdS
Posts: 37
Hi there,
I'm trying to convert a little program written in C to pbasic, so I can kick out a microcontroller I don't want and replace it with the BS2 all my other stuff works great with.
Can anybody help me out here?
The programm goes like this:
void setup()
{
Serial.begin(38400);
delay(1000);
Serial.println("F8D1D1");
delay(500);
Serial.println("Ctester");
delay(200);
}
void loop()
{
Serial.print("STest 1,2,3");
Serial.println("Test Test!");
}
I gave it a try but it doesn't work, so I guess I'moverlooking something....
I'm trying to convert a little program written in C to pbasic, so I can kick out a microcontroller I don't want and replace it with the BS2 all my other stuff works great with.
Can anybody help me out here?
The programm goes like this:
void setup()
{
Serial.begin(38400);
delay(1000);
Serial.println("F8D1D1");
delay(500);
Serial.println("Ctester");
delay(200);
}
void loop()
{
Serial.print("STest 1,2,3");
Serial.println("Test Test!");
}
I gave it a try but it doesn't work, so I guess I'moverlooking something....
Comments
What I can figure out:
38400 is the baud rate
F8D1D1 is the frrequency at which a STENSAT radio transmitter is to transmit data
tester would be a call sign
delay = pause (though not necessarily in the same units)
serial.print and serial.println would be SOMEW>HAT akin to 'serout'
as for all the rest, it might be Sanscrit for all the sense it me to poor pityful me
Erik
It looks like the serial.begin sets the Baud and, on the Stamp, this information is included in each SEROUT statement.
serial.print is the equivalent to SEROUT and the quoted string is what gets SEROUTed.
serial.println is the same as serial.print, but with a carriage return ($0D) added to the end of whatever's sent.
The stuff in the "setup" function is once-only initialization stuff
The stuff in the "loop" function is repeated continuously
You're correct about the "delay" function. I think the delay units are the same as the Stamp's PAUSE units (milliseconds).
baud CON 38400
main:
pause 1000
serout TX,baud "F8D1D1", cr
pause 500
serout TX,baud "Ctester", cr
pause 200
Do
serout TX, baud "STest 1,2,3"
serout TX, baud "Test! Test!", CR
Loop
A little rough, consult the PBasic guide for the specifics on SEROUT.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
TC!
Erik