○使用LCD
・パラレル接続
1602 16x2 Character LCD Display Module Blue Blacklight
・I2C接続
waves 1602 IIC/I2C/TWI LCD液晶 モジュール Arduino 青
○LCD制御用端子
Arduino 0~13
Raspberry Pi(※) GPIO04~026
※Model A+/B+/Raspberry Pi 2/ Raspberry Pi 3/Raspberry Pi Zero
○基本回路/プログラム
★パラレル接続
◇Arduino
・配線
・プログラム
◇Raspberry Pi
・配線
・プログラム
This file contains 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
raspi = require('raspi-io'); | |
var five = require("johnny-five"); | |
var board = new five.Board({io: new raspi()}); | |
board.on("ready", function() { | |
var random = Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 4).toUpperCase(); | |
// Controller: PARALLEL (default) | |
var p = new five.LCD({ | |
pins: ['P1-7', 'P1-8', 'P1-10', 'P1-11', 'P1-12', 'P1-13'], | |
backlight: 10, | |
}); | |
p.useChar("heart"); | |
p.cursor(0, 0).print("hello :heart:"); | |
p.blink(); | |
p.cursor(1, 0).print("Blinking? "); | |
p.cursor(0, 10).print(random); | |
setTimeout(function() { | |
process.exit(0); | |
}, 3000); | |
}) |
★I2C接続
◇Arduino
・配線
モジュール
|
Arduino
|
GND
|
GND
|
VCC
|
VCC
|
SDA
|
A4
|
SCL
|
A5
|
・プログラム
◇Raspberry Pi
・配線
モジュール
|
Raspberry Pi(※)
|
GND
|
6
|
VCC
|
2
|
SDA
|
3
|
SCL
|
5
|
※物理的なピン番号で表記しています。
・プログラム
This file contains 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
raspi = require('raspi-io'); | |
var five = require("johnny-five"); | |
var board = new five.Board({io: new raspi()}); | |
board.on("ready", function() { | |
var random = Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 4).toUpperCase(); | |
// Controller: PCF8574A (Generic I2C) | |
// Locate the controller chip model number on the chip itself. | |
var l = new five.LCD({ | |
controller: "PCF8574A" | |
}); | |
l.useChar("heart"); | |
l.cursor(0, 0).print("Hello :heart:"); | |
l.blink(); | |
l.cursor(1, 0).print("Blinking? "); | |
l.cursor(0, 10).print(random); | |
setTimeout(function() { | |
process.exit(0); | |
}, 3000); | |
}); |
0 件のコメント:
コメントを投稿