SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top