Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. int analogInPin = A1;
  2. int digitalOutPin = 9;
  3. int sensorReading;
  4. float frequency;
  5.  
  6. void setup() {
  7. Serial.begin(9600);
  8. pinMode(digitalOutPin, OUTPUT);
  9.  
  10. }
  11.  
  12. void loop() {
  13. // put your main code here, to run repeatedly:
  14. sensorReading = analogRead(analogInPin);
  15. Serial.println(sensorReading);
  16.  
  17. frequency = map(sensorReading, 0, 1000, 100, 1000);
  18. tone(digitalOutPin, frequency);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement