Advertisement
Guest User

arduino

a guest
Jan 17th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. int analogInput = A2;
  2. int pwmOutput = 3;
  3.  
  4. void setup() {
  5. // put your setup code here, to run once:
  6. pinMode(analogInput, INPUT);
  7. pinMode(pwmOutput, OUTPUT);
  8. }
  9.  
  10. void loop() {
  11. // put your main code here, to run repeatedly:
  12. if(analogRead(analogInput)>300){
  13. analogWrite(pwmOutput, 200);
  14. }
  15. else{
  16. analogWrite(pwmOutput, 0);
  17. }
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement