Examples | Shop
 
Simple application of the Interface Module
Uni-directional serial
communication from
OOPic to PC
 
This example demonstrates a simple application of the RS 232 port on the Interface Module.
The Interface Module enables the OOPic module to be connected to the 9 pin serial communications port on a PC. A female to female, null modem cable and a 9 pin slim line gender changer are required to make the connection.
In the example a Sharp GP2D12 Infrared detector is connected to the OOPic. When the sensor is approached the oSerial object sends a warning message to the PC that is displayed on screen via Windows Hyper Terminal.
A set up file for Hyper Terminal can be found here.

OOPic code (compiler version 3.0.5)
 
dim serialout as new oSerial
dim ADC as new oA2D

sub main()

oopic.node=1

do
Oopic.extvref=0
ADC.ioline=1
ADC.operate=cvTrue

if ADC.value>65 then

serialout.Baud=cv9600
serialout.Mode=0
serialout.Operate=cvTrue
serialout.string="Back off you're too close !!!"

oopic.delay=50

else
serialout.string="   OK   "


oopic.delay=50

end if
loop

end sub
 

Examples | Shop