To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 2017
2016  |  2018
Subject: 
Analog RCX Clock
Newsgroups: 
lugnet.robotics.rcx, lugnet.robotics.rcx.nqc
Date: 
Tue, 8 Apr 2003 19:53:53 GMT
Viewed: 
6006 times
  
It has been along while since I have dug out my RCX and brushed up on my NQC
skills. Also having a fascination for old clocks and watches and I wanted to
build a RCX controlled clock for work.  I found Ben Williamson's web page
for a Lego Analog Clock and decided to give a whirl.  Needed to redesign a
little using the Mindstorms rotation sensor and update the NQC code.  20
minutes of construction and 30 minutes re-doing the code, it runs fine.  In
case anybody wishes to try it also, the updated code is below.  No pictures
at the moment, soon on Brickshelf.

Peter

Ben's original design
http://unite.com.au/~u11235a/lego/clock/index.html

New code:

#define ROTATION  SENSOR_1
#define MOTOR    OUT_A
#define STEP      1     /* set to 1 for 1/16 rotation */

int curr_watch;    /* set up of variables */
int old_watch;
int temp;

sub step()      /* step clock one time increment */
{
  OnRev(MOTOR);
  while (ROTATION < STEP);
  Off(MOTOR);
  ClearSensor(ROTATION);
}

task main()
{
SetSensor(ROTATION, SENSOR_ROTATION);
ClearSensor(ROTATION);
  SetPower(MOTOR, 1);
  SetSleepTime(0);      /* do not power down */

old_watch = Watch();  /* get clock from rcx */
while(true)
  {
  curr_watch = Watch();
  if( curr_watch != old_watch )
    {
   old_watch = curr_watch;
   temp = (curr_watch / 5) * 5;
   if (temp != curr_watch)
    step();
  }
}  /* end of while loop */
}  /* end of main */



Message has 1 Reply:
  Re: Analog RCX Clock
 
... "Peter Kraus" <pkraus@frontiernet.net> wrote in message news:HD1JD6.24xH@lugnet.com... (...) NQC (...) to (...) In (...) pictures (...) (20 years ago, 13-May-04, to lugnet.robotics.rcx.nqc)

2 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