You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Temperature does not display correctly on CPB. Works on CPX board. The code below works with Microsoft Makecode and Maker Makecode with CPX board. Try it on Maker Makecode with hardware set to CPB board to recreate problem. With CPB board all neopixels light up for about 3 seconds then go off after reset button is pushed once. May not be reading input.temperature at all. With CPX board Neopixels turn on in clockwise direction with increase temperature. Temperature Farenheit is constrained between 60 and 80 degrees. The code does not work in Maker Makecode with CPB! It does not use graph block.
`/**
CP-Temperature-CW
Example of using neopixels to measure temperature rise in
clockwise direction on CPX/CPB board.
*/
let np = 0
let n = 0
let Tc = 0
let T = 0
light.onboardStrip().setBrightness(20)
let Tmin = 60
let Tmax = 80
forever(function () {
T = input.temperature(TemperatureUnit.Fahrenheit)
Tc = Math.constrain(T, Tmin, Tmax)
n = Math.map(Tc, Tmin, Tmax, 0, light.onboardStrip().length() - 1)
if (T < Tmin) {
light.onboardStrip().setAll(0x000000)
} else {
for (let index = 0; index <= light.onboardStrip().length() - 1; index++) {
np = light.onboardStrip().length() - 1 - index
if (index <= n) {
light.onboardStrip().setPixelColor(np, light.hsv(18 * np, 255, 255))
} else {
light.onboardStrip().setPixelColor(np, 0x000000)
}
}
}
pause(1000)
}) `
Here's another example that uses the graph block to plot temperature on the onboard neopixels.
It works on CPX but not on CPB. All the onboard neopixels on the CPB board are on.
The text was updated successfully, but these errors were encountered:
V2man
changed the title
Temperature displayed on CPX/CPB on board neopixels
Temperature displayed on CPX/CPB with board neopixels
Feb 22, 2020
V2man
changed the title
Temperature displayed on CPX/CPB with board neopixels
Temperature displayed on CPX/CPB with onboard neopixels
Feb 22, 2020
V2man
changed the title
Temperature displayed on CPX/CPB with onboard neopixels
Plot of temperature using onboard neopixels does not work on CPB board
Feb 22, 2020
Temperature does not display correctly on CPB. Works on CPX board. The code below works with Microsoft Makecode and Maker Makecode with CPX board. Try it on Maker Makecode with hardware set to CPB board to recreate problem. With CPB board all neopixels light up for about 3 seconds then go off after reset button is pushed once. May not be reading input.temperature at all. With CPX board Neopixels turn on in clockwise direction with increase temperature. Temperature Farenheit is constrained between 60 and 80 degrees. The code does not work in Maker Makecode with CPB! It does not use graph block.
`/**
*/
let np = 0
let n = 0
let Tc = 0
let T = 0
light.onboardStrip().setBrightness(20)
let Tmin = 60
let Tmax = 80
forever(function () {
T = input.temperature(TemperatureUnit.Fahrenheit)
Tc = Math.constrain(T, Tmin, Tmax)
n = Math.map(Tc, Tmin, Tmax, 0, light.onboardStrip().length() - 1)
if (T < Tmin) {
light.onboardStrip().setAll(0x000000)
} else {
for (let index = 0; index <= light.onboardStrip().length() - 1; index++) {
np = light.onboardStrip().length() - 1 - index
if (index <= n) {
light.onboardStrip().setPixelColor(np, light.hsv(18 * np, 255, 255))
} else {
light.onboardStrip().setPixelColor(np, 0x000000)
}
}
}
pause(1000)
}) `
Here's another example that uses the graph block to plot temperature on the onboard neopixels.
It works on CPX but not on CPB. All the onboard neopixels on the CPB board are on.
CPX-T20t30-With-Graph.txt
The text was updated successfully, but these errors were encountered: