+ Reply to Thread
Results 1 to 2 of 2

Thread: Javelin stamp and LISY300 communication

  1. #1

    Default Javelin stamp and LISY300 communication

    Hi all,

    I've encountered a problem with my javelin. My javelin and my gyro (lisy300) won't communicate properly. I do get signals which vary as a gyro should, but they aren't correct. I've connected all wires like on the example code on the BS2. Here is my code:

    -----------------------------------------CODE----------------------------------------------------------------------------------------

    import stamp.core.*;
    import stamp.math.*;




    class gyrotest{


    static int dout;
    static int sclk;
    static int csn;


    static int value;


    public static void main() {
    dout=CPU.pin0;
    sclk=CPU.pin1;
    csn=CPU.pin2;
    value=0;


    CPU.writePin(csn,true);
    CPU.writePin(sclk,false);
    CPU.delay(500);


    value=readGyro();
    forst=value;
    while(true){
    value=readGyro();
    System.out.println(value/*area*/);
    CPU.delay(50);
    }
    }


    public static int readGyro(){


    CPU.writePin(csn,false);
    int x=CPU.shiftIn(dout,sclk,13,CPU.POST_CLOCK_MSB);
    CPU.writePin(csn,true);


    return x;
    }
    }


    -----------------------------------------CODEEND----------------------------------------------------------------------------------

    I think there is a problem with the trailing zeroes or something like that.

    Example of output is:
    0
    0
    0
    0
    3
    0
    0
    0
    0
    0
    0
    6
    0
    0
    3
    3
    0

    Thank for reading my post, all replies are welcome!

  2. #2

+ Reply to Thread

Similar Threads

  1. Reading LISY300 Gyro with a Stamp 2 Microcontroller
    By crazyarch93 in forum Sensors
    Replies: 2
    Last Post: 02-20-2011, 08:17 PM
  2. Serial communication PC <--> Javelin
    By Robot Freak in forum Javelin Stamp
    Replies: 8
    Last Post: 04-18-2009, 12:20 AM
  3. Javelin to BS2 communication.
    By Kevin B Slater in forum Javelin Stamp
    Replies: 12
    Last Post: 08-04-2006, 01:41 AM
  4. javelin stamp<=>pc serial communication specifications?
    By bearclaw in forum Javelin Stamp
    Replies: 15
    Last Post: 10-28-2005, 12:05 AM
  5. Replies: 1
    Last Post: 03-20-2002, 01:57 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts