Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. int photocell = A1;
  2. int photoread = 0;
  3. int yellow = 10;
  4. int blue = 9;
  5.  
  6. int potent = A0;
  7. int potentread = 0;
  8. int potentmap = 0;
  9. int photomap = 0;
  10.  
  11. void setup() {
  12. // put your setup code here, to run once:
  13. pinMode(yellow, OUTPUT);
  14. pinMode(blue, OUTPUT);
  15. Serial.begin(9600);
  16. }
  17.  
  18. void loop() {
  19. // put your main code here, to run repeatedly:
  20. photoread = analogRead(photocell);
  21. //Serial.println(photoread);
  22. potentread = analogRead(potent);
  23. Serial.println(potentread);
  24. potentmap = map(potentread, 0, 1023, 0, 255);
  25. photomap = map(photoread, 0, 1023, 0, 255);
  26. analogWrite(yellow, potentmap);
  27. analogWrite(blue, photomap);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement