Advertisement
Guest User

Untitled

a guest
May 6th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. "use strict";
  2. function CustomCode(Counter0, Counter1, Counter2) {
  3. var rgb = 0;
  4. var motor = '';
  5.  
  6. if (Counter0 >= Counter1 && Counter0 >= Counter2) {
  7. rgb = [100,0,0];
  8. motor = 'DCMotor0';
  9. } else if (Counter1 >= Counter0 && Counter1 >= Counter2) {
  10. rgb = [0,100,0];
  11. motor = 'DCMotor1';
  12. } else if (Counter2 >= Counter0 && Counter2 >= Counter1) {
  13. rgb = [0,0,100];
  14. motor = 'DCMotor2';
  15. }
  16.  
  17. this.sendTo('RGBLED0', rgb);
  18.  
  19. // Turn off all motors
  20. this.sendTo('DCMotor0', 0);
  21. this.sendTo('DCMotor1', 0);
  22. this.sendTo('DCMotor2', 0);
  23.  
  24. // Turn on the only motor selected
  25. if (motor) {
  26. this.sendTo(motor, 100);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement