HTML

blink_button-i.c

Oct 30th, 2017
259
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. // code is not currently working correctly, do not use //
  2. #pragma config(Sensor, in1,    button,         sensorAnalog)
  3. #pragma config(Sensor, dgtl1,  red,            sensorLEDtoVCC)
  4. #pragma config(Sensor, dgtl2,  yellow,         sensorLEDtoVCC)
  5. #pragma config(Sensor, dgtl3,  green,          sensorLEDtoVCC)
  6. //*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
  7.  
  8. task main()
  9. {
  10.     while (1 == 1)
  11. {
  12.         while(SensorValue(button) == 0)
  13. {
  14.             turnLEDOn(red);
  15.             turnLEDOn(yellow);
  16.             turnLEDOn(green);
  17.             wait(.5);
  18.             turnLEDOff(red);
  19.             turnLEDOff(yellow);
  20.             turnLEDOff(green);
  21.             wait(.5);
  22. }
  23.         while(SensorValue(button) == 1)
  24. {
  25.             turnLEDOff(red);
  26.             turnLEDOff(yellow);
  27.             turnLEDOff(green);
  28. }
  29. }
  30. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment