tSimplify program and fix various bugs. Tested on RCX - lego_film_processor - software for rotary photographic film processor with Lego Mindstorms RCX
(HTM) git clone git://src.adamsgaard.dk/lego_film_processor
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 6350d48897168b5f89ac7b83e4e560bfcee32c9d
(DIR) parent b8909fbc53bfccfb57ef79d9fda901a6a6d8b73d
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 12 Jul 2019 16:12:21 +0200
Simplify program and fix various bugs. Tested on RCX
Diffstat:
M lego_jobo.nqc | 43 ++++++++++++-------------------
1 file changed, 17 insertions(+), 26 deletions(-)
---
(DIR) diff --git a/lego_jobo.nqc b/lego_jobo.nqc
t@@ -1,48 +1,39 @@
#define T_TURN 500 /* turn each way for 5 s */
-#define OUTPUT OUT_A
#define DEVELOP_MINS 10 /* number of minutes to develop for */
#define DEVELOP_SECS 30 /* number of seconds to develop for */
-#define chime_speed 1
-
-void
-end_chime(int repeats)
-{
- int i;
- for (i=0; i<repeats; ++i) {
- PlayTone(147, 50*chime_speed); /* d */
- PlayTone(156, 50*chime_speed); /* d# */
- PlayTone(147, 50*chime_speed); /* d */
- PlayTone(294, 100*chime_speed); /* d+1 */
-
- PlayTone(147, 50*chime_speed); /* d */
- PlayTone(156, 50*chime_speed); /* d# */
- PlayTone(147, 50*chime_speed); /* d */
- PlayTone(175, 100*chime_speed); /* f */
- }
-}
-
task
main()
{
int t_current, t_end;
+ Off(OUT_A + OUT_B + OUT_C);
SetSleepTime(60);
- Off(OUTPUT);
- SetPower(OUTPUT, OUT_FULL); /* second arg an int between 0 and 7 */
+ SetPower(OUT_A, OUT_FULL); /* second arg an int between 0 and 7 */
+ On(OUT_A);
t_current = 0;
t_end = 60*DEVELOP_MINS + DEVELOP_SECS;
while (t_current < t_end) {
Wait(T_TURN);
- Toggle(OUTPUT);
+ Toggle(OUT_A);
- t_current += T_TURN;
+ t_current += T_TURN/100;
}
- Off(OUTPUT);
- end_chime(4);
+ Off(OUT_A + OUT_B + OUT_C);
+
+ PlayTone(147, 20); /* d */
+ PlayTone(156, 20); /* d# */
+ PlayTone(147, 20); /* d */
+ PlayTone(294, 40); /* d+1 */
+
+ PlayTone(147, 20); /* d */
+ PlayTone(156, 20); /* d# */
+ PlayTone(147, 20); /* d */
+ PlayTone(175, 40); /* f */
+
SetSleepTime(5);
}