To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 3298
3297  |  3299
Subject: 
Re: Rotation and Touch Sensors on one input
Newsgroups: 
lugnet.robotics
Date: 
Thu, 28 Jan 1999 16:42:57 GMT
Viewed: 
1074 times
  
Eric Haberfellner writes:
lego-robotics@crynwr.com (Markus L. Noga) writes:
Hi Eric,

Eric Haberfellner wrote:
I was playing around with legOS 0.1.5 last night (thanks for legOS Markus) • and
was able to get the rotation sensor code working fairly well. While doing • this

You're welcome. Could you be more specific than "fairly well"? I've
heard different stories. Some people reported rotation works perfectly
in one direction and not at all in the other. Others experienced other
results. Did you modify the state machine code? If yes, several people
might want to try your patches.

Ciao,

Markus.

--
Markus and others, here is my modified version of direct-sensor.c
Sorry that this is so long, but I do not have a web site to post this on.
-- snip --

In the file that I just posted there is a section which looks like this in
ds_rotation_handler ()

  unsigned int cnt; //ERH
  lcd_int ( raw );  //ERH
//  lcd_int (state);  //ERH
  lcd_refresh ();   //ERH
  for ( cnt = 0; cnt < 10000; cnt++ ); //ERH


This will cause the state machine to run slowly, and put apparent junk on the
LCD display. This is debug code that I was using to observe RAW and state
values. Either remove it or replace it with:

//  unsigned int cnt; //ERH
//  lcd_int ( raw );  //ERH
//  lcd_int (state);  //ERH
//  lcd_refresh ();   //ERH
//  for ( cnt = 0; cnt < 10000; cnt++ ); //ERH

Once again I would like to thank Markus for legOS. He did all the hard work.
All I did was tinker with the state machine a little bit.

Also, in order to use the touch sensor on the same input you have to modify
the wake up function in rotation-sensor.c to look something like this:

--

#define BUTTON_PRESS 100

// rotation change event wakeup function
//
wakeup_t rotation_change_wakeup(wakeup_t data) {
  static unsigned rot;
  unsigned *address=(unsigned*) ((unsigned)data);

  //ignore changed value if it is due to button press
  //This way, we do not generate false rotation events.
  if ( (*address >> 6) < BUTTON_PRESSED )
    return 0;

  if(*address != rot) {
    rot=*address;
    return 1;
  }
  return 0;
}



Message is in Reply To:
  Re: Rotation and Touch Sensors on one input
 
(...) and (...) this (...) Markus and others, here is my modified version of direct-sensor.c Sorry that this is so long, but I do not have a web site to post this on. -- // // legOS - the independent LEGO Mindstorms OS // direct-sensor.c - direct (...) (26 years ago, 28-Jan-99, to lugnet.robotics)

4 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR