concept display in category javascript

appears as: display, display, displays
JavaScript on Things: Hacking hardware for web developers

This is an excerpt from Manning's book JavaScript on Things: Hacking hardware for web developers.

In this circuit, the potentiometer’s middle pin is connected directly to the LCD’s pin 3. The LCD’s onboard electronics read the voltage on that pin to determine the contrast of the display. Rotating the potentiometer will, therefore, adjust the contrast.

Using the GPS breakout in this combined-sensor project seems like it would be a nifty idea. However, Johnny-Five support for software serial is relatively fresh, and some of the complications of implementing software serial mean that it can be hard to predict how much data a sensor is going to communicate (the data exchange isn’t structured like I2C in that regard). Because of this, at the time of writing, combining a GPS with other sensors or output can cause garbage-y issues with the LCD’s display and other unpredictable behavior.

7.5.3. Step 3: updating the display to show temperature and pressure

Displaying temperature, atmospheric pressure, and compass heading at the same time overcrowds the limited 16x2 character space on the LCD. It would be better if we split the display into two screenfuls: one to display temperature and pressure, and the other to show compass heading. In our first version, there won’t be a way to swap between the two screens—it’ll just show temperature and pressure—but we’ll come back to that in a few moments.

Listing 7.10. multi-sensor.js: updating the display formatting
function formatDisplay (readings, altDisplay) { 1 var displayLine1, displayLine2; if (altDisplay) { 2 displayLine1 = 'HEADING: '; displayLine2 = Math.round(readings.heading) + ':circle:'; } else { displayLine1 = 'TEMP/PRESSURE:'; displayLine2 = readings.temperature.toFixed(1) + ':circle:F'; displayLine2 += ' / ' + Math.round(10 * readings.pressure) + 'mb'; 3 } return [displayLine1, displayLine2]; }