Subject:
|
Re: Analog RCX Clock
|
Newsgroups:
|
lugnet.robotics.rcx.nqc
|
Date:
|
Thu, 13 May 2004 01:42:07 GMT
|
Viewed:
|
6800 times
|
| |
| |
...
"Peter Kraus" <pkraus@frontiernet.net> wrote in message
news:HD1JD6.24xH@lugnet.com...
> 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 is in Reply To:
| | Analog RCX Clock
|
| 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 (...) (22 years ago, 8-Apr-03, to lugnet.robotics.rcx, lugnet.robotics.rcx.nqc)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|