Page 1 of 1

PostPosted: Mon Feb 24, 2003 11:11 am
by rmh
Does anyone know about any PocketC library for the lego minstorms robot,also i have a program called pbrick, that does the IR functions i want, got the C source, can it be used by PocketC

PostPosted: Mon Feb 24, 2003 9:40 pm
by Todd Z
If you have all the information for the IR connection, you can just use the built-in functions that PocketC has. If you wanted to make specific functions to have them do different things to the brick, you could just make the functions in your program by declaring them, or making your own library used through an include.

PostPosted: Sun Apr 17, 2005 11:37 pm
by otakribut1
what is the progress of your work. of trying to get pocketC to control LEGO? i've tried--but still no luck. i know that opcodes can be used to control lego. and, to control directly using infrared may not work. it must be send through serial connection to the ir tower. then ir tower to lego rcx. to open port to this ir tower is still too complicated for me. i've tried using open file, send serial ..but not blink on the ir tower. this is a qbasic code for opening port to ir tower for cybermaster. i've tried it on mindstorm. doesn't work?
maybe some of this setting need to be changed. don't know which?

by bert van Dam---"
SUB LegoOpenCom

'This is the addres of Com 2, change this if you're using another port.
'com1=&H3F8 com2=&H2F8 com3=&H3E8 com4=&H2E8 com5=&H2F0 com6=&H3E0 com7=&H2E0 com8=&H260
'lpt1=&H378 lpt2=&H278 lpt3=&H3BC
Register = &H3F8

'Open the comport for random, disable all checks (otherwise some sort
'of handshaking protocol will start, and there's noting to shake hands
'with). Note the size of the buffers, you need lots of buffers to keep up.
OPEN "COM1:2400,N,8,1,CD0,CS0,DS0,OP0,RS,TB8192,RB8192" FOR RANDOM AS #1

'What we really want is Odd (but this can't be done in Basic) so
'change the Line Control Register accordingly (offset 3 to COM address)
OUT (Register + 3), &HB

'For the Cybermaster DTR line must be high (default) and RTS line must
'be low. So force RTS and DTR in the Modem Control Register (offset 4 to
'the COM address).
Temp = INP(Register + 4)
Temp = Temp OR 1 'DTR on
Temp = Temp AND NOT 2 'RTS off
OUT (Register + 4), Temp