Advertisement
Guest User

arduinosadge

a guest
Jul 7th, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. int softpotPin = A5;
  2.  
  3. void setup() {
  4. Serial.begin(9600);
  5. digitalWrite(softpotPin, HIGH);
  6. }
  7.  
  8. void loop() {
  9. int softpotReading = analogRead(softpotPin);
  10. int pitchpot = round(softpotReading * (127/1020));
  11. float test = (softpotReading / 1020) * 127;
  12. Serial.println(softpotReading);
  13. // returns btwn 1020 and 0 based on where I touch the potentiometer, default w/ no touch is 1020
  14. Serial.println(test, 5);
  15. // returns 0
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement