To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.loc.itOpen lugnet.loc.it in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Local / Italia / 10049
10048  |  10050
Subject: 
Re: rotation sensor
Newsgroups: 
lugnet.loc.it
Date: 
Sun, 23 Dec 2001 11:10:53 GMT
Viewed: 
228 times
  
SteP wrote:

Chi mi può - ehm- aiutare col NQC? Vorrei fare la seguente routine: quando
il sensore di rotazione legge un incremento (decremento) di angolo, aziona
il motore per qualche ms.

int sens;

task main()
{
  SetSensor(SENSOR_1,SENSOR_ROTATION);
  sens == SENSOR_1;
  while (true)
  {
    if (SENSOR_1 > sens)
      {
        OnFwd(OUT_A);
        Wait(10);  // aspetta un decimo
        Off(OUT_A);
        sens == SENSOR_1;
      }
    else if (SENSOR_1 < sens)
      {
        OnRev(OUT_C);
        Wait(10);  // aspetta un decimo
        Off(OUT_C);
        sens == SENSOR_1;
      }
  }
}


Questo dovrebbe andare meglio. A seconda di quello che vuoi fare, però, si
possono inserire controlli e procedure più specifiche..

Ciao
Giulio



Message has 1 Reply:
  R: rotation sensor
 
Grazie per la dritta, ma non funziona neppure questo! Forse sul tuo sì, (chissà, io ho un RIS 1.5 aggiornato alla "beta" 2)ma sul mio sortisce un effetto simile al precedente prg, con la differenza che parte da un valore del contatore (sempre -20, (...) (23 years ago, 23-Dec-01, to lugnet.loc.it)

Message is in Reply To:
  rotation sensor
 
Salve gente! Chi mi può - ehm- aiutare col NQC? Vorrei fare la seguente routine: quando il sensore di rotazione legge un incremento (decremento) di angolo, aziona il motore per qualche ms. Io ho provato con qualcosa di simile (segue), ma succede (...) (23 years ago, 22-Dec-01, to lugnet.loc.it)

6 Messages in This Thread:


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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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