Program for driving unipolar stepper motor model RoHS 28BYJ-48 12 VDC. Motor can be driven in wave, full step, and half step modes in clockwise and anticlockwise directions.

Dependencies:   mbed

Committer:
nmoorthy2001
Date:
Tue Sep 20 09:25:50 2016 +0000
Revision:
6:2db0077aae0d
Parent:
5:f81d343c3d7a
Program for driving unipolar stepper motor model RoHS 28BYJ-48  12 VDC. Motor can be driven in wave, full step, and half step modes in clockwise and anticlockwise directions.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nmoorthy2001 5:f81d343c3d7a 1
nmoorthy2001 5:f81d343c3d7a 2 /*
nmoorthy2001 5:f81d343c3d7a 3 Stepper Motor Driver Program version 2
nmoorthy2001 5:f81d343c3d7a 4
nmoorthy2001 5:f81d343c3d7a 5 Written By N. Moorthy Muthukrishnan, Hyderabad, India Date : 27 July 2016
nmoorthy2001 5:f81d343c3d7a 6
nmoorthy2001 5:f81d343c3d7a 7 This program is written for FRDM KL25Z for driving unipolar stepper motor with four coils and common terminal
nmoorthy2001 5:f81d343c3d7a 8 Stepper Motor Model RoHS 28BYJ-48 12 VDC, use only 5 VDC power supply for driver board.
nmoorthy2001 5:f81d343c3d7a 9
nmoorthy2001 5:f81d343c3d7a 10 Four wires from the stepper motor are of colors blue, pink, yellow, and orange.
nmoorthy2001 5:f81d343c3d7a 11 Connected to PTB8, PTB9, PTB10, and PTB11, respectively.
nmoorthy2001 5:f81d343c3d7a 12
nmoorthy2001 5:f81d343c3d7a 13 Red wire is common.
nmoorthy2001 5:f81d343c3d7a 14
nmoorthy2001 5:f81d343c3d7a 15 Blue = coil 1 Pink = coil 2
nmoorthy2001 5:f81d343c3d7a 16 Yellow = coil 3 Orange = coil 4
nmoorthy2001 5:f81d343c3d7a 17 Red = common
nmoorthy2001 5:f81d343c3d7a 18
nmoorthy2001 6:2db0077aae0d 19 A ULN2003 driver board is used to drive the stepper motor.
nmoorthy2001 5:f81d343c3d7a 20 A Variable named mode is used to select the mode of operation of the stepper motor.
nmoorthy2001 5:f81d343c3d7a 21 wave drive mode = 0
nmoorthy2001 5:f81d343c3d7a 22 full step mode = 1
nmoorthy2001 5:f81d343c3d7a 23 half step mode = 2
nmoorthy2001 5:f81d343c3d7a 24
nmoorthy2001 5:f81d343c3d7a 25 A variable dir is used to define the direction of rotation
nmoorthy2001 5:f81d343c3d7a 26 direction dir = 0 anticlockwise
nmoorthy2001 5:f81d343c3d7a 27 direction dir = 1 clockwise
nmoorthy2001 5:f81d343c3d7a 28 */
nmoorthy2001 5:f81d343c3d7a 29
chris 0:0024ab6b9624 30 #include "mbed.h"
chris 0:0024ab6b9624 31
nmoorthy2001 5:f81d343c3d7a 32 #define DLY 0.1 // delay in seconds
nmoorthy2001 5:f81d343c3d7a 33
nmoorthy2001 5:f81d343c3d7a 34 DigitalOut blue(PTB8);
nmoorthy2001 5:f81d343c3d7a 35 DigitalOut pink(PTB9);
nmoorthy2001 5:f81d343c3d7a 36 DigitalOut yellow(PTB10);
nmoorthy2001 5:f81d343c3d7a 37 DigitalOut orange(PTB11);
nmoorthy2001 5:f81d343c3d7a 38 Serial pc(USBTX,USBRX);
nmoorthy2001 5:f81d343c3d7a 39
nmoorthy2001 5:f81d343c3d7a 40 //variable
nmoorthy2001 5:f81d343c3d7a 41 static int mode = 0;
nmoorthy2001 5:f81d343c3d7a 42 static int dir = 0;
nmoorthy2001 5:f81d343c3d7a 43
nmoorthy2001 5:f81d343c3d7a 44 void wave_anticlockwise(void);
nmoorthy2001 5:f81d343c3d7a 45 void fullstep_anticlockwise(void);
nmoorthy2001 5:f81d343c3d7a 46 void halfstep_anticlockwise(void);
nmoorthy2001 5:f81d343c3d7a 47
nmoorthy2001 5:f81d343c3d7a 48 void wave_clockwise(void);
nmoorthy2001 5:f81d343c3d7a 49 void fullstep_clockwise(void);
nmoorthy2001 5:f81d343c3d7a 50 void halfstep_clockwise(void);
nmoorthy2001 5:f81d343c3d7a 51
nmoorthy2001 5:f81d343c3d7a 52 void motor_idle(void);
nmoorthy2001 5:f81d343c3d7a 53
nmoorthy2001 5:f81d343c3d7a 54 int main()
nmoorthy2001 5:f81d343c3d7a 55 {
nmoorthy2001 5:f81d343c3d7a 56
nmoorthy2001 5:f81d343c3d7a 57 // enter mode in the following line
nmoorthy2001 5:f81d343c3d7a 58 // 0 for wave drive, 1 for full step, 2 for half step
nmoorthy2001 5:f81d343c3d7a 59
nmoorthy2001 5:f81d343c3d7a 60 mode = 0;
nmoorthy2001 5:f81d343c3d7a 61
nmoorthy2001 5:f81d343c3d7a 62 //enter dir = 0 for anticlockwise rotation, dir = 1 for clockwise rotation
nmoorthy2001 5:f81d343c3d7a 63 dir = 0;
nmoorthy2001 5:f81d343c3d7a 64
nmoorthy2001 5:f81d343c3d7a 65 pc.printf("\n\r");
nmoorthy2001 5:f81d343c3d7a 66 pc.printf("****** Stepper Motor starting ******* \n\r");
nmoorthy2001 5:f81d343c3d7a 67 pc.printf("Mode = %d Direction = %d \n\r", mode, dir);
nmoorthy2001 5:f81d343c3d7a 68
nmoorthy2001 5:f81d343c3d7a 69 while (true)
nmoorthy2001 5:f81d343c3d7a 70 {
nmoorthy2001 5:f81d343c3d7a 71 if (dir == 0)
nmoorthy2001 5:f81d343c3d7a 72 {
nmoorthy2001 5:f81d343c3d7a 73 pc.printf("Motor in anticlockwise rotation\n\r");
nmoorthy2001 5:f81d343c3d7a 74 // wave drive
nmoorthy2001 5:f81d343c3d7a 75 if (mode == 0)
nmoorthy2001 5:f81d343c3d7a 76 {
nmoorthy2001 5:f81d343c3d7a 77 wave_anticlockwise();
nmoorthy2001 5:f81d343c3d7a 78 }
nmoorthy2001 5:f81d343c3d7a 79
nmoorthy2001 5:f81d343c3d7a 80 // full step
nmoorthy2001 5:f81d343c3d7a 81 else if (mode == 1)
nmoorthy2001 5:f81d343c3d7a 82 {
nmoorthy2001 5:f81d343c3d7a 83 fullstep_anticlockwise();
nmoorthy2001 5:f81d343c3d7a 84 }
nmoorthy2001 5:f81d343c3d7a 85
nmoorthy2001 5:f81d343c3d7a 86 // half step
nmoorthy2001 5:f81d343c3d7a 87 else if (mode == 2)
nmoorthy2001 5:f81d343c3d7a 88 {
nmoorthy2001 5:f81d343c3d7a 89 halfstep_anticlockwise();
nmoorthy2001 5:f81d343c3d7a 90 }
nmoorthy2001 5:f81d343c3d7a 91 else
nmoorthy2001 5:f81d343c3d7a 92 {
nmoorthy2001 5:f81d343c3d7a 93 pc.printf("Invalid mode, Motor idle \n\r");
nmoorthy2001 5:f81d343c3d7a 94 motor_idle();
nmoorthy2001 5:f81d343c3d7a 95 }
nmoorthy2001 5:f81d343c3d7a 96 }
nmoorthy2001 5:f81d343c3d7a 97
nmoorthy2001 5:f81d343c3d7a 98 else if (dir == 1)
nmoorthy2001 5:f81d343c3d7a 99 {
nmoorthy2001 5:f81d343c3d7a 100 pc.printf("Motor in clockwise rotation \n\r");
nmoorthy2001 5:f81d343c3d7a 101 // wave drive
nmoorthy2001 5:f81d343c3d7a 102 if (mode == 0)
nmoorthy2001 5:f81d343c3d7a 103 {
nmoorthy2001 5:f81d343c3d7a 104 wave_clockwise();
nmoorthy2001 5:f81d343c3d7a 105 }
nmoorthy2001 5:f81d343c3d7a 106
nmoorthy2001 5:f81d343c3d7a 107 // full step
nmoorthy2001 5:f81d343c3d7a 108 else if (mode == 1)
nmoorthy2001 5:f81d343c3d7a 109 {
nmoorthy2001 5:f81d343c3d7a 110 fullstep_clockwise();
nmoorthy2001 5:f81d343c3d7a 111 }
nmoorthy2001 5:f81d343c3d7a 112
nmoorthy2001 5:f81d343c3d7a 113 // half step
nmoorthy2001 5:f81d343c3d7a 114 else if (mode == 2)
nmoorthy2001 5:f81d343c3d7a 115 {
nmoorthy2001 5:f81d343c3d7a 116 halfstep_clockwise();
nmoorthy2001 5:f81d343c3d7a 117 }
nmoorthy2001 5:f81d343c3d7a 118
nmoorthy2001 5:f81d343c3d7a 119 else
nmoorthy2001 5:f81d343c3d7a 120 {
nmoorthy2001 5:f81d343c3d7a 121 pc.printf("Invalid mode, Motor idle \n\r");
nmoorthy2001 5:f81d343c3d7a 122 motor_idle();
nmoorthy2001 5:f81d343c3d7a 123 }
nmoorthy2001 5:f81d343c3d7a 124
nmoorthy2001 5:f81d343c3d7a 125 }
nmoorthy2001 5:f81d343c3d7a 126
nmoorthy2001 5:f81d343c3d7a 127 else
nmoorthy2001 5:f81d343c3d7a 128 {
nmoorthy2001 5:f81d343c3d7a 129 pc.printf("Invalid direction, Motor idle \n\r");
nmoorthy2001 5:f81d343c3d7a 130 motor_idle();
nmoorthy2001 5:f81d343c3d7a 131 }
nmoorthy2001 5:f81d343c3d7a 132
nmoorthy2001 5:f81d343c3d7a 133 }
nmoorthy2001 5:f81d343c3d7a 134 }
nmoorthy2001 5:f81d343c3d7a 135
nmoorthy2001 5:f81d343c3d7a 136 // function for wave drive in anticlockwise direction
nmoorthy2001 5:f81d343c3d7a 137 void wave_anticlockwise()
nmoorthy2001 5:f81d343c3d7a 138 {
nmoorthy2001 5:f81d343c3d7a 139 pc.printf("Motor in wave drive \n\r");
nmoorthy2001 5:f81d343c3d7a 140 blue = 0;
nmoorthy2001 5:f81d343c3d7a 141 pink = 0;
nmoorthy2001 5:f81d343c3d7a 142 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 143 orange = 1;
nmoorthy2001 5:f81d343c3d7a 144 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 145
nmoorthy2001 5:f81d343c3d7a 146 blue = 0;
nmoorthy2001 5:f81d343c3d7a 147 pink = 0;
nmoorthy2001 5:f81d343c3d7a 148 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 149 orange = 0;
nmoorthy2001 5:f81d343c3d7a 150 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 151
nmoorthy2001 5:f81d343c3d7a 152 blue = 0;
nmoorthy2001 5:f81d343c3d7a 153 pink = 1;
nmoorthy2001 5:f81d343c3d7a 154 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 155 orange = 0;
nmoorthy2001 5:f81d343c3d7a 156 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 157
nmoorthy2001 5:f81d343c3d7a 158 blue = 1;
nmoorthy2001 5:f81d343c3d7a 159 pink = 0;
nmoorthy2001 5:f81d343c3d7a 160 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 161 orange = 0;
nmoorthy2001 5:f81d343c3d7a 162 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 163 }
nmoorthy2001 5:f81d343c3d7a 164
nmoorthy2001 5:f81d343c3d7a 165 // function for full step in anticlockwise direction
nmoorthy2001 5:f81d343c3d7a 166 void fullstep_anticlockwise()
nmoorthy2001 5:f81d343c3d7a 167 {
nmoorthy2001 5:f81d343c3d7a 168 pc.printf("Motor in full step \n\r");
nmoorthy2001 5:f81d343c3d7a 169 blue = 0;
nmoorthy2001 5:f81d343c3d7a 170 pink = 0;
nmoorthy2001 5:f81d343c3d7a 171 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 172 orange = 1;
nmoorthy2001 5:f81d343c3d7a 173 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 174
nmoorthy2001 5:f81d343c3d7a 175 blue = 0;
nmoorthy2001 5:f81d343c3d7a 176 pink = 1;
nmoorthy2001 5:f81d343c3d7a 177 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 178 orange = 0;
nmoorthy2001 5:f81d343c3d7a 179 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 180
nmoorthy2001 5:f81d343c3d7a 181 blue = 1;
nmoorthy2001 5:f81d343c3d7a 182 pink = 1;
nmoorthy2001 5:f81d343c3d7a 183 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 184 orange = 0;
nmoorthy2001 5:f81d343c3d7a 185 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 186
nmoorthy2001 5:f81d343c3d7a 187 blue = 1;
nmoorthy2001 5:f81d343c3d7a 188 pink = 0;
nmoorthy2001 5:f81d343c3d7a 189 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 190 orange = 1;
nmoorthy2001 5:f81d343c3d7a 191 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 192 }
chris 0:0024ab6b9624 193
nmoorthy2001 5:f81d343c3d7a 194 // function for half step in anticlockwise direction
nmoorthy2001 5:f81d343c3d7a 195 void halfstep_anticlockwise()
nmoorthy2001 5:f81d343c3d7a 196 {
nmoorthy2001 5:f81d343c3d7a 197 pc.printf("Motor in half step \n\r");
nmoorthy2001 5:f81d343c3d7a 198 blue = 0;
nmoorthy2001 5:f81d343c3d7a 199 pink = 0;
nmoorthy2001 5:f81d343c3d7a 200 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 201 orange = 1;
nmoorthy2001 5:f81d343c3d7a 202 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 203
nmoorthy2001 5:f81d343c3d7a 204 blue = 0;
nmoorthy2001 5:f81d343c3d7a 205 pink = 0;
nmoorthy2001 5:f81d343c3d7a 206 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 207 orange = 1;
nmoorthy2001 5:f81d343c3d7a 208 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 209
nmoorthy2001 5:f81d343c3d7a 210 blue = 0;
nmoorthy2001 5:f81d343c3d7a 211 pink = 0;
nmoorthy2001 5:f81d343c3d7a 212 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 213 orange = 0;
nmoorthy2001 5:f81d343c3d7a 214 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 215
nmoorthy2001 5:f81d343c3d7a 216 blue = 0;
nmoorthy2001 5:f81d343c3d7a 217 pink = 1;
nmoorthy2001 5:f81d343c3d7a 218 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 219 orange = 0;
nmoorthy2001 5:f81d343c3d7a 220 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 221
nmoorthy2001 5:f81d343c3d7a 222 blue = 0;
nmoorthy2001 5:f81d343c3d7a 223 pink = 1;
nmoorthy2001 5:f81d343c3d7a 224 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 225 orange = 0;
nmoorthy2001 5:f81d343c3d7a 226 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 227
nmoorthy2001 5:f81d343c3d7a 228 blue = 1;
nmoorthy2001 5:f81d343c3d7a 229 pink = 1;
nmoorthy2001 5:f81d343c3d7a 230 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 231 orange = 0;
nmoorthy2001 5:f81d343c3d7a 232 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 233
nmoorthy2001 5:f81d343c3d7a 234 blue = 1;
nmoorthy2001 5:f81d343c3d7a 235 pink = 0;
nmoorthy2001 5:f81d343c3d7a 236 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 237 orange = 0;
nmoorthy2001 5:f81d343c3d7a 238 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 239
nmoorthy2001 5:f81d343c3d7a 240 blue = 1;
nmoorthy2001 5:f81d343c3d7a 241 pink = 0;
nmoorthy2001 5:f81d343c3d7a 242 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 243 orange = 1;
nmoorthy2001 5:f81d343c3d7a 244 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 245
nmoorthy2001 5:f81d343c3d7a 246 }
nmoorthy2001 5:f81d343c3d7a 247
nmoorthy2001 5:f81d343c3d7a 248 // function for wave drive in clockwise direction
nmoorthy2001 5:f81d343c3d7a 249 void wave_clockwise()
nmoorthy2001 5:f81d343c3d7a 250 {
nmoorthy2001 5:f81d343c3d7a 251 pc.printf("Motor in wave drive \n\r");
nmoorthy2001 5:f81d343c3d7a 252 blue = 1;
nmoorthy2001 5:f81d343c3d7a 253 pink = 0;
nmoorthy2001 5:f81d343c3d7a 254 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 255 orange = 0;
nmoorthy2001 5:f81d343c3d7a 256 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 257
nmoorthy2001 5:f81d343c3d7a 258 blue = 0;
nmoorthy2001 5:f81d343c3d7a 259 pink = 1;
nmoorthy2001 5:f81d343c3d7a 260 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 261 orange = 0;
nmoorthy2001 5:f81d343c3d7a 262 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 263
nmoorthy2001 5:f81d343c3d7a 264 blue = 0;
nmoorthy2001 5:f81d343c3d7a 265 pink = 0;
nmoorthy2001 5:f81d343c3d7a 266 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 267 orange = 0;
nmoorthy2001 5:f81d343c3d7a 268 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 269
nmoorthy2001 5:f81d343c3d7a 270 blue = 0;
nmoorthy2001 5:f81d343c3d7a 271 pink = 0;
nmoorthy2001 5:f81d343c3d7a 272 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 273 orange = 1;
nmoorthy2001 5:f81d343c3d7a 274 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 275 }
nmoorthy2001 5:f81d343c3d7a 276
nmoorthy2001 5:f81d343c3d7a 277 // function for full step in clockwise direction
nmoorthy2001 5:f81d343c3d7a 278 void fullstep_clockwise()
nmoorthy2001 5:f81d343c3d7a 279 {
nmoorthy2001 5:f81d343c3d7a 280 pc.printf("Motor in full step \n\r");
nmoorthy2001 5:f81d343c3d7a 281
nmoorthy2001 5:f81d343c3d7a 282 blue = 1;
nmoorthy2001 5:f81d343c3d7a 283 pink = 0;
nmoorthy2001 5:f81d343c3d7a 284 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 285 orange = 1;
nmoorthy2001 5:f81d343c3d7a 286 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 287
nmoorthy2001 5:f81d343c3d7a 288 blue = 1;
nmoorthy2001 5:f81d343c3d7a 289 pink = 1;
nmoorthy2001 5:f81d343c3d7a 290 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 291 orange = 0;
nmoorthy2001 5:f81d343c3d7a 292 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 293
nmoorthy2001 5:f81d343c3d7a 294 blue = 0;
nmoorthy2001 5:f81d343c3d7a 295 pink = 1;
nmoorthy2001 5:f81d343c3d7a 296 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 297 orange = 0;
nmoorthy2001 5:f81d343c3d7a 298 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 299
nmoorthy2001 5:f81d343c3d7a 300 blue = 0;
nmoorthy2001 5:f81d343c3d7a 301 pink = 0;
nmoorthy2001 5:f81d343c3d7a 302 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 303 orange = 1;
nmoorthy2001 5:f81d343c3d7a 304 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 305 }
nmoorthy2001 5:f81d343c3d7a 306
nmoorthy2001 6:2db0077aae0d 307 void halfstep_clockwise()
nmoorthy2001 5:f81d343c3d7a 308 {
nmoorthy2001 5:f81d343c3d7a 309 halfstep_clockwise();
nmoorthy2001 5:f81d343c3d7a 310 pc.printf("Motor in half step \n\r");
nmoorthy2001 5:f81d343c3d7a 311 blue = 0;
nmoorthy2001 5:f81d343c3d7a 312 pink = 0;
nmoorthy2001 5:f81d343c3d7a 313 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 314 orange = 1;
nmoorthy2001 5:f81d343c3d7a 315 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 316
nmoorthy2001 5:f81d343c3d7a 317 blue = 1;
nmoorthy2001 5:f81d343c3d7a 318 pink = 0;
nmoorthy2001 5:f81d343c3d7a 319 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 320 orange = 1;
nmoorthy2001 5:f81d343c3d7a 321 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 322
nmoorthy2001 5:f81d343c3d7a 323 blue = 0;
nmoorthy2001 5:f81d343c3d7a 324 pink = 0;
nmoorthy2001 5:f81d343c3d7a 325 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 326 orange = 0;
nmoorthy2001 5:f81d343c3d7a 327 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 328
nmoorthy2001 5:f81d343c3d7a 329 blue = 1;
nmoorthy2001 5:f81d343c3d7a 330 pink = 1;
nmoorthy2001 5:f81d343c3d7a 331 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 332 orange = 0;
nmoorthy2001 5:f81d343c3d7a 333 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 334
nmoorthy2001 5:f81d343c3d7a 335 blue = 0;
nmoorthy2001 5:f81d343c3d7a 336 pink = 1;
nmoorthy2001 5:f81d343c3d7a 337 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 338 orange = 0;
nmoorthy2001 5:f81d343c3d7a 339 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 340
nmoorthy2001 5:f81d343c3d7a 341 blue = 0;
nmoorthy2001 5:f81d343c3d7a 342 pink = 1;
nmoorthy2001 5:f81d343c3d7a 343 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 344 orange = 0;
nmoorthy2001 5:f81d343c3d7a 345 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 346
nmoorthy2001 5:f81d343c3d7a 347 blue = 1;
nmoorthy2001 5:f81d343c3d7a 348 pink = 0;
nmoorthy2001 5:f81d343c3d7a 349 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 350 orange = 0;
nmoorthy2001 5:f81d343c3d7a 351 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 352
nmoorthy2001 5:f81d343c3d7a 353 blue = 0;
nmoorthy2001 5:f81d343c3d7a 354 pink = 0;
nmoorthy2001 5:f81d343c3d7a 355 yellow = 1;
nmoorthy2001 5:f81d343c3d7a 356 orange = 1;
nmoorthy2001 5:f81d343c3d7a 357 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 358 }
nmoorthy2001 5:f81d343c3d7a 359
nmoorthy2001 6:2db0077aae0d 360 void motor_idle()
nmoorthy2001 5:f81d343c3d7a 361 {
nmoorthy2001 5:f81d343c3d7a 362 blue = 0;
nmoorthy2001 5:f81d343c3d7a 363 pink = 0;
nmoorthy2001 5:f81d343c3d7a 364 yellow = 0;
nmoorthy2001 5:f81d343c3d7a 365 orange = 0;
nmoorthy2001 5:f81d343c3d7a 366 wait(DLY);
nmoorthy2001 5:f81d343c3d7a 367
chris 0:0024ab6b9624 368 }