forked from ChristopherRush/BB-Evil-Genius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProject 5.js
33 lines (29 loc) · 975 Bytes
/
Project 5.js
1
var b = require('bonescript');var RedPin = "P8_13";var GreenPin = "P8_19";var BluePin = "P9_14";var S1Value = 0.0;var S2Value = 0.0;var S3Value = 0.0;b.pinMode(RedPin, b.OUTPUT);b.pinMode(GreenPin, b.OUTPUT);b.pinMode(BluePin, b.OUTPUT);setInterval(fade, 100);function fade(){ b.analogRead('P9_40', Red); function Red(x) { S1Value = x.value; b.analogWrite(RedPin, S1Value); console.log('Red value = ' + x.value); console.log('x.err = ' + x.err); b.analogRead('P9_38', Green); function Green(x) { S2Value = x.value; b.analogWrite(GreenPin, S2Value); console.log('Green value = ' + x.value); b.analogRead('P9_36', Blue); function Blue(x) { S3Value = x.value; b.analogWrite(BluePin, S3Value); console.log('Blue value = ' + x.value); }}}}