In order to get values on the hyper terminar I tried to develop
last week's code. And I use again the syntax, "call putQueueStr(outputBuffer,
chr(13) & chr(10))" to got values arrangedly and clearly
using ASCII code.
dim
outputBuffer(1 To 45) as byte
dim inputBuffer(1 To 13) as byte
dim
potVar as integer
dim FSRvar as integer
dim photocellVar as integer
Sub main()
do
call delay(0.5) ' start program with a half-second delay
call openQueue(outputBuffer, 45)
call openQueue(inputBuffer, 13)
call defineCom3(11,12,bx1000_1000)
call openCom(3, 9600, inputBuffer, outputBuffer)
FSRvar = getADC(13)
potVar = getADC(14)
photocellVar = getADC(15)
'debug.print
"FSRvar = " ; cstr(FSRVar)
'debug.print "potVar = " ; cstr(potVar)
'debug.print "photocellVar = " ; cstr(photocellVar)
'myString1 = "the FSR states: " & chr(cstr(FSRVar)
'myString2 = "the potentiometer states: " & chr(cstr(potVar)
'myString3 = "the photocell states: " & chr(cstr(photocellVar)
'call
putQueueStr(outputBuffer, myString1)
'' Append carriage return and line feed
'call putQueueStr(outputBuffer, chr(13) & chr(10))
'call
putQueueStr(outputBuffer, myString2)
'' Append carriage return and line feed
'call putQueueStr(outputBuffer, chr(13) & chr(10))
'call
putQueueStr(outputBuffer, myString3)
'' Append carriage return and line feed
'call putQueueStr(outputBuffer, chr(13) & chr(10))
call
putQueue(outputBuffer, FSRvar, 1)
call putQueue(outputBuffer, potVar, 1)
call putQueue(outputBuffer, photocellVar, 1)
loop
End
Sub
--------------------------------------------------------------------------
Test Note :
photocell
value ranges from 30(hand on)- 750(hand off)
photentiometer value 0-1023
FSR range 0-708
--------------------------------------------------------------------------
For
this week's assignment, I used a potetiometer, a FSR and a photocell.
And in Director I want ed to make a beer glass and a beer bottle
each of which was interactive with the above sensors. But I
could understand the meaning that the most difficult part in
Pcomp is making a smooth interaction by programming. Really
it was hard to me to get the things which were interactive each
other. Actually I wanted to make a program that if users touch
a FSR, then bottle is poring beer into cup and if users turn
potentiometer , then the height of beer in the glass increases
or decreases according to the values. But the tricky part was
controlling the values with potentiometer and using different
values from diverse sensors simultaneously, because all values
were connected together, so I ccould't control them step by
step at each time when I want to use. For example, although
the beer bottle increases the height in glass at first, next
part code affect s the height of beer almost simutaneously.
And because the present range of potentiometer also affects
the values, it also hard to control. So I finally gave up making
the objects as I planned. But it was good to know the fact again
that programming is hard! Especailly making smooth actions through
programming!!
BX
code
dim outputBuffer(1 To 45) as byte
dim inputBuffer(1 To 13) as byte
dim
potVar as integer
dim FSRvar as integer
dim photocellVar as integer
Sub main()
do
call delay(0.5) ' start program with a half-second delay
call openQueue(outputBuffer, 45)
call openQueue(inputBuffer, 13)
call defineCom3(11,12,bx1000_1000)
call openCom(3, 9600, inputBuffer, outputBuffer)
FSRvar = getADC(13) '\ 4 + 3
potVar = getADC(14)
photocellVar = getADC(15)
debug.print
"FSRvar = " ; cstr(FSRVar)
debug.print "potVar = " ; cstr(potVar)
debug.print "photocellVar = " ; cstr(photocellVar)
call
putQueue(outputBuffer, FSRvar, 1)
call putQueue(outputBuffer, potVar, 1)
call putQueue(outputBuffer, photocellVar, 1)
loop
---------------------------------------------------------------------------
|