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 / 10048
10047  |  10049
Subject: 
rotation sensor
Newsgroups: 
lugnet.loc.it
Date: 
Sat, 22 Dec 2001 21:05:15 GMT
Viewed: 
192 times
  
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 solo che dopo qualche decina di giri (sic!) comincia a partire in
una direzione e non si ferma più.
Ecco il codice:

int sens;
task main()
{
  SetSensor(SENSOR_1,SENSOR_ROTATION); ClearSensor(SENSOR_1);

  while (true)
  { sens == SENSOR_1;
    if (SENSOR_1 == sens + 1)
      {OnFwd(OUT_A); Wait(1);}
    else if (SENSOR_1 == sens -1)
      {OnRev(OUT_C); Wait(1);}

  }
}

In pratica vorrei fare un "servocomando", con un rotation solo (l'unico che
ho...)
Grazie a chi mi aiuta. Agli altri un po' di auguri ;)
PS: ma come è finita col libro made by Ferrari bros.?



Message has 1 Reply:
  Re: rotation sensor
 
(...) int sens; task main() { SetSensor(SENSOR_1,S...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); (...) (23 years ago, 23-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
    

Custom Search

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