Great! In this case you should be able to do what you want in normal JavaScript, so actually delving into Espruino itself isn't needed - maybe that link should mention it?
So you need to implement setPWMFreq, but the general outline of what you need should be there for the other stuff. I did setPWM because Espruino can do it a bit more tidily than Arduino can.
Part of me thinks it's worth just setting it to 60Hz by default and adding a 'setServo' function as well though. Most people are going to use this board/chip for servos anyway :)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Great! In this case you should be able to do what you want in normal JavaScript, so actually delving into Espruino itself isn't needed - maybe that link should mention it?
What you really need is: http://www.espruino.com/Writing+Modules
The modules that use I2c (http://www.espruino.com/I2C#using-i2c) are a good start - and the code for them is usually here: https://github.com/espruino/EspruinoDocs/tree/master/devices
To get you started, just copy/paste this into the Web IDE:
So you need to implement setPWMFreq, but the general outline of what you need should be there for the other stuff. I did
setPWM
because Espruino can do it a bit more tidily than Arduino can.Other thing to note is that servos don't run at 1000Hz (the default) so you have to use Adafruit's example: https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library/blob/master/examples/servo/servo.ino
Part of me thinks it's worth just setting it to 60Hz by default and adding a 'setServo' function as well though. Most people are going to use this board/chip for servos anyway :)