Hello, I am developing a project. This project consist in connect to SCRATCH a plate. This plate send and recibe signals of SCRATCH.
My problem is when "ScratchBoard watcher" is reading information of plate, I can't send signals to the plate.
I would get while the "ScratchBoard watcher" is reading data, I can send signals to plate.
Could somebody help?
Thanks
PD: This is de code:
SendInfo: act number: num
| b1 b2 p i n chanel|
b1 <- num bitshift:-8.
b2 <- num bitand: 16rff.
p <-(act*2)-1.
"Save info in a table"
actTable at:p put:b1.
actTable at:(p+1) put:b2.
chanel <-CanalsTable at:act.
(b2 bitand:16r80) > 0 iftrue: [
i<-16r01. ]
iffalse: [
i<-16r00. ].
n <- (16r80 bitor:chanel) bitor:i.
b1 <- b1 bitshift:1.
b1 <- b1 bitor:n.
b2 <- b2 bitand:16r7f.
self portisopen
iftrue: [
port nextput:16r35.
port nextput:b1.
port nextput:b2.
]
iffalse:
[
port -> serialport2 new openportnamed:'com1' baud:38400.
port nextput:16r35.
port nextput:b1.
port nextput:b2.
port close.
].
Offline
try this:
SendInfo: act number: num
| b1 b2 p i n chanel|
b1 _ num bitshift:-8.
b2 _ num bitand: 16rff.
p _(act*2)-1.
"Save info in a table"
actTable at:p put:b1.
actTable at:(p+1) put:b2.
chanel _CanalsTable at:act.
(b2 bitand:16r80) > 0 ifTrue: [
i_16r01. ]
ifFalse: [
i_16r00. ].
n _ (16r80 bitor:chanel) bitor:i.
b1 _ b1 bitshift:1.
b1 _ b1 bitor:n.
b2 _ b2 bitAnd:16r7f.
self portIsOpen
ifTrue: [
port nextput:16r35.
port nextput:b1.
port nextput:b2.
]
ifFalse:
[
port _ serialport2 new openportnamed:'com1' baud:38400.
port nextput:16r35.
port nextput:b1.
port nextput:b2.
port close.
].
Offline