Skip to content

Instantly share code, notes, and snippets.

@xseignard
Created September 19, 2012 16:44
Show Gist options
  • Save xseignard/3750697 to your computer and use it in GitHub Desktop.
Save xseignard/3750697 to your computer and use it in GitHub Desktop.
38kHz signal with breakout js
arduino.setDigitalPinMode(11, Pin.PWM);
var led = arduino.getDigitalPin(11);
console.log(led);
var freq = 0.000026316; // 38kHz = 38000 cycles per seconds = 38000^-1 seconds per cycle = 0.000026316 seconds per cycle
var amplitude = 2.0;
var offset = 0;
var phase = 0;
var repeat = 0;
var sinewave = new Oscillator(Oscillator.SIN, freq, amplitude, offset, phase, repeat);
led.addGenerator(sinewave);
sinewave.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment