Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- function CustomCode(Counter0, Counter1, Counter2) {
- var rgb = 0;
- var motor = '';
- if (Counter0 >= Counter1 && Counter0 >= Counter2) {
- rgb = [100,0,0];
- motor = 'DCMotor0';
- } else if (Counter1 >= Counter0 && Counter1 >= Counter2) {
- rgb = [0,100,0];
- motor = 'DCMotor1';
- } else if (Counter2 >= Counter0 && Counter2 >= Counter1) {
- rgb = [0,0,100];
- motor = 'DCMotor2';
- }
- this.sendTo('RGBLED0', rgb);
- // Turn off all motors
- this.sendTo('DCMotor0', 0);
- this.sendTo('DCMotor1', 0);
- this.sendTo('DCMotor2', 0);
- // Turn on the only motor selected
- if (motor) {
- this.sendTo(motor, 100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement