Subject:
|
ScriptEd - Question
|
Newsgroups:
|
lugnet.robotics.rcx
|
Date:
|
Wed, 3 Aug 2005 20:35:12 GMT
|
Viewed:
|
4003 times
|
| |
| |
Hi,
I'm a newby with RCX, and need verry urgent a program (readdy by next saturday),
to control a few motors and switches as input. Now, i installed the SDK 2.5 and
use the ScriptED (Mindscript Editor).
Situation:
A monorail track (same track for forward / return) with 4 stations. One on every
end of the track and two in between. Every station has following actuators:
1 motor connected on the Monorail Track Switch (2772c01.dat)
1 switch who detects the STOP position of the Monorail Track Switch
1 switch to detect the monorail train in the station
So have to control 4 motors, and would use 2 RCX bricks for it. Every Brick will
control one endstation and one middle station.
My program is as follow (for 1 RCX!):
program Monorail_RCX1{
// Declarations
//
sensor sw1 on 1 // sensor on gear box (END station)
sensor sw2 on 2 // sensor to detect monorail into ENDstation
sensor sw3 on 3 // sensor on gear box (MIDDLE station)
sensor sw4 on 2 // sensor to detect monorail into MIDDLE station
sw1 is switch as boolean
sw2 is switch as boolean
sw3 is switch as boolean
sw4 is switch as boolean
//
direction_ // direction of monorail
const delay1=1500 // minimum stop time in station (10 seconds)
const delay2=3000 // maximum stop time in station (30 seconds)
//
output motor1 on 1 // motor connected to physical port A
output motor2 on 2 // motor connected to physical port B
//
event endstationtime when {sw1 &= sw2).pressed
event middlestationtime when {sw3 &= sw4}.pressed
//
// End of Declarations
//
main {
start endstation
start middlestation
}
//
// Monorail is IN END STATION
watcher endstation monitor endstationtime {
wait delay2 // stoptime = 30 seconds
power motor1 6 // motor power = 6
forward motor1 for 200 // enable monorail to drive away - motor on 2sec
of motor1 for 50 // stop motor 0.5sec
while sw1 is not closed backward motor1 // return to stop position
}
// Monorail is IN MIDDLE STATION
watcher middlestation monitor middlestationtime {
wait delay1 // stoptime = 15 seconds
power motor2 6 // motor power = 6
if direction=0
forward motor2 for 200 // enable monorail to drive away - motor on 2sec
of motor2 for 50 // stop motor 0.5sec
while sw3 is not closed backward motor2 // return to stop position
direction_=1
else
backward motor2 for 200 // enable monorail to drive away
of motor2 for 50 // stop motor
while sw3 is not closed forward motor2 // return to stop position
direction_=0 // Monorail left END station
}
How do i doawnload it into the RCX? I see a button in the toolbar (Ctrl+D), but
notthing happens. Are there errors in the program?
Anyone out there who can help me?
Thanks in advance,
Ludo
|
|
Message has 1 Reply: | | Re: ScriptEd - Question
|
| (...) When you click the download button (or press Ctrl+D) it should give you a message in the status bar, at the bottom of the screen. Steve (19 years ago, 3-Aug-05, to lugnet.robotics.rcx)
|
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|