Advertisement
shopnilSS

ProjectOFMicroProcessor

Dec 6th, 2021
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. int level;
  2. const int analog_0=0;
  3. int l1=13;
  4. int l2=12;
  5. int l3=11;
  6. int l4=10;
  7.  
  8. void setup() {
  9. // put your setup code here, to run once:
  10. Serial.begin(9600);
  11. pinMode(l1,OUTPUT);
  12. pinMode(l2,OUTPUT);
  13. pinMode(l3,OUTPUT);
  14. pinMode(l4,OUTPUT);
  15. pinMode(8,OUTPUT);
  16. }
  17.  
  18. void loop() {
  19.  
  20. // put your main code here, to run repeatedly:
  21. level=analogRead(analog_0);
  22. Serial.println(level);
  23. if(level>500&&level<550)
  24. { digitalWrite(l1, HIGH);
  25. digitalWrite(l2, LOW);
  26. digitalWrite(l3, LOW);
  27. digitalWrite(l4, LOW);
  28.  
  29. }
  30. else if(level>600&&level<620)
  31. {
  32. digitalWrite(l1, LOW);
  33. digitalWrite(l2, HIGH);
  34. digitalWrite(l3, LOW);
  35. digitalWrite(l4, LOW);
  36.  
  37. }
  38.  
  39. else if(level>620&&level<630)
  40. {
  41. digitalWrite(l1, LOW);
  42. digitalWrite(l2, LOW);
  43. digitalWrite(l3, HIGH);
  44. digitalWrite(l4, LOW);
  45.  
  46. }
  47.  
  48. else if(level>630&&level<650)
  49. {
  50. digitalWrite(l1, LOW);
  51. digitalWrite(l2, LOW);
  52. digitalWrite(l3, LOW);
  53. digitalWrite(l4, HIGH);
  54. digitalWrite(8, HIGH);
  55. }
  56.  
  57. }
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement