Created
June 21, 2014 03:52
-
-
Save danielfilho/12906710711022931cf2 to your computer and use it in GitHub Desktop.
If you're going to work with spark core and want to have an arduino for faster development in flaky wifi connections (or whatever reason), use the pin set as an object, so you can change everywhere at once, when switching devices.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pins = { | |
spark: { | |
servo: 'D0', | |
button: 'D7', | |
red: 'A0', | |
green: 'A1', | |
blue: 'A4' | |
}, | |
arduino: { | |
servo: 10, | |
button: 8, | |
red: 3, | |
green: 5, | |
blue: 6 | |
} | |
}; | |
// on spark core | |
var button = new five.Button(pins.spark.button); | |
var servo = new five.Servo(pins.spark.servo); | |
// on arduino | |
var button = new five.Button(pins.arduino.button); | |
var servo = new five.Servo(pins.arduino.servo); | |
// so this will always work on both hardwares | |
button.on('down', buttonDown); | |
servo.sweep(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment