I tried writing a program similar to whats there in tht link..
here is what i tried (and failed)...
Delay=2000;
Void main(void){
oByte b1=new oByte; //holds incoming data
oByte b2=new oByte; //holds pre-defined data
b2.Value=5; //assgined a value 5
oSerialPort sp=new oSerialPort;
oLed l1=new oLed; //leds for testing
oLed l2=new oLed;
l1.IOLine=5;
l2.IOLine=6;
sp.Operate=1;
Do{
If(sp.received==cvTrue){
l1.TurnOn; //just to check whether it has entered this block
//that means data is received..this glows
b1.Value=sp.Value;
If(b1.Value==b2.Value){
l2.TurnOn; //if comparision was successful..doesnt glow
}
}//end of outer IF
}//end of DO
}//end of main
Data is being received by oopic,but the comparision fails...
Iam trying to send data from java J2ME program running in a
mobile...Java J2ME has a method to write data to output stream..
Documentation says this about the method which am using to send data:
write(int b) :Writes the specified byte to the output stream. The
general contract for write is that one byte is written to the output
stream. The byte to be written is the eight low-order bits of the
argument b. The 24 high-order bits of b are ignored.
i used write(5); in my sending code..
Next i tried comparing the received value b1.Value with all 0-255
values..by incrementing and comparing,using another byte value
starting from zero...None of the values from 0-255 matches b1.Value!
pls help me..
thank you
--- In oopic@yahoogroups.com, <dennis.clark@...> wrote:
>
> Thanks Dan, that's a nice link.
>
> DLC
>
> ooPIC Tech Support
>
> -----Original Message-----
>
> From: "dan michaels" <oric_dan@...>
> Subj: [oopic] Re: Interpreting serial data.
> Date: Tue Jan 8, 2008 8:25 am
> Size: 1K
> To: oopic@yahoogroups.com
>
> --- In oopic@yahoogroups.com, "aravind_2917" <aravind_2917@> wrote:
> >
> > hello,
> >
> > Iam trying to communicate with oopic from my mobile over the
serial
> > port using bluetooth dongle...everything is working fine...i can
> make out that data is being transmitted to the oopic and oopic is
> receiving the data...
> >
> > Iam sending single character from the mobile...like 's' for
> example...i can even send a single byte from the mobile..
> >
> > Now,how do i interpret the data received by OOPIC...am using
> > oSerialPort object...
> >
> > oSerailPort sp=new oSerialPort;
> > sp.Operate=1;
> >
> > i want to compare the values received ,with predefined values and
> carry out other tasks accordingly...like ,start a motor if 's' is
> > received..stop the motor if 't' is received...How do i do
> that?..what are the conversions and comparisions involved?
> >
>
>
> I have example code that does similar to what you describe on the
> bottom of this page ...
>
> http://www.oricomtech.com/projects/rolandp.htm
>
>
> - dan michaels
> www.oricomtech.com
> --- OOBOT40 Boards ---
> =========================
>
>
>
>
>
> Yahoo! Groups Links
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
No comments:
Post a Comment